mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +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:
@@ -6,6 +6,7 @@
|
||||
|
||||
use std::task::Poll;
|
||||
|
||||
use crate::utils::strip_compact_prefix;
|
||||
use crate::{
|
||||
client::OnlineClientT,
|
||||
error::{DispatchError, Error, RpcError, TransactionError},
|
||||
@@ -80,7 +81,7 @@ where
|
||||
TxStatus::InBlock(s) | TxStatus::Finalized(s) => return Ok(s),
|
||||
// Error scenarios; return the error.
|
||||
TxStatus::FinalityTimeout(_) => {
|
||||
return Err(TransactionError::FinalityTimeout.into())
|
||||
return Err(TransactionError::FinalityTimeout.into());
|
||||
}
|
||||
TxStatus::Invalid => return Err(TransactionError::Invalid.into()),
|
||||
TxStatus::Usurped(_) => return Err(TransactionError::Usurped.into()),
|
||||
@@ -109,7 +110,7 @@ where
|
||||
TxStatus::Finalized(s) => return Ok(s),
|
||||
// Error scenarios; return the error.
|
||||
TxStatus::FinalityTimeout(_) => {
|
||||
return Err(TransactionError::FinalityTimeout.into())
|
||||
return Err(TransactionError::FinalityTimeout.into());
|
||||
}
|
||||
TxStatus::Invalid => return Err(TransactionError::Invalid.into()),
|
||||
TxStatus::Usurped(_) => return Err(TransactionError::Usurped.into()),
|
||||
@@ -260,7 +261,6 @@ impl<T: Config, C: Clone> Stream for TxProgress<T, C> {
|
||||
/// In any of these cases the client side TxProgress stream is also closed.
|
||||
/// In those cases the stream is closed however, so you currently have no way to find
|
||||
/// out if they finally made it into a block or not.
|
||||
|
||||
#[derive(Derivative)]
|
||||
#[derivative(Debug(bound = "C: std::fmt::Debug"))]
|
||||
pub enum TxStatus<T: Config, C> {
|
||||
@@ -389,7 +389,10 @@ impl<T: Config, C: OnlineClientT<T>> TxInBlock<T, C> {
|
||||
.iter()
|
||||
.position(|ext| {
|
||||
use crate::config::Hasher;
|
||||
let hash = T::Hasher::hash_of(&ext.0);
|
||||
let Ok((_,stripped)) = strip_compact_prefix(&ext.0) else {
|
||||
return false;
|
||||
};
|
||||
let hash = T::Hasher::hash_of(&stripped);
|
||||
hash == self.ext_hash
|
||||
})
|
||||
// If we successfully obtain the block hash we think contains our
|
||||
|
||||
Reference in New Issue
Block a user