mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
chain_getBlock extrinsics encoding (#1024)
* deserialize without decoding * change decoding approach * fix tests * decode without allocating * strip compact prefix * cargo fmt * nit adjustment
This commit is contained in:
+2
-14
@@ -110,20 +110,8 @@ pub type ConsensusEngineId = [u8; 4];
|
||||
pub type EncodedJustification = Vec<u8>;
|
||||
|
||||
/// Bytes representing an extrinsic in a [`ChainBlock`].
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ChainBlockExtrinsic(pub Vec<u8>);
|
||||
|
||||
impl<'a> ::serde::Deserialize<'a> for ChainBlockExtrinsic {
|
||||
fn deserialize<D>(de: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: ::serde::Deserializer<'a>,
|
||||
{
|
||||
let r = impl_serde::serialize::deserialize(de)?;
|
||||
let bytes = Decode::decode(&mut &r[..])
|
||||
.map_err(|e| ::serde::de::Error::custom(format!("Decode error: {e}")))?;
|
||||
Ok(ChainBlockExtrinsic(bytes))
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct ChainBlockExtrinsic(#[serde(with = "impl_serde::serialize")] pub Vec<u8>);
|
||||
|
||||
/// Wrapper for NumberOrHex to allow custom From impls
|
||||
#[derive(Serialize)]
|
||||
|
||||
Reference in New Issue
Block a user