Skip to content

Commit

Permalink
other modules updated
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkucharczyk committed Nov 26, 2024
1 parent 04af09b commit bf2dd1f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions substrate/bin/node/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ kitchensink-runtime = { workspace = true }
sc-client-api = { workspace = true, default-features = true }
sp-runtime = { workspace = true, default-features = true }
sp-state-machine = { workspace = true, default-features = true }
sp-blockchain = { workspace = true, default-features = true }
serde = { workspace = true, default-features = true }
serde_json = { workspace = true, default-features = true }
derive_more = { features = ["display"], workspace = true }
Expand Down
6 changes: 5 additions & 1 deletion substrate/bin/node/bench/src/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ impl sc_transaction_pool_api::TransactionPool for Transactions {
unimplemented!()
}

fn remove_invalid(&self, _hashes: &[TxHash<Self>]) -> Vec<Arc<Self::InPoolTransaction>> {
fn report_invalid(
&self,
_at: Option<Self::Hash>,
_invalid_tx_errors: &[(TxHash<Self>, Option<sp_blockchain::Error>)],
) -> Vec<Arc<Self::InPoolTransaction>> {
Default::default()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ impl TransactionPool for MiddlewarePool {
Ok(watcher.boxed())
}

fn remove_invalid(&self, hashes: &[TxHash<Self>]) -> Vec<Arc<Self::InPoolTransaction>> {
self.inner_pool.remove_invalid(hashes)
fn report_invalid(
&self,
at: Option<<Self::Block as BlockT>::Hash>,
invalid_tx_errors: &[(TxHash<Self>, Option<sp_blockchain::Error>)],
) -> Vec<Arc<Self::InPoolTransaction>> {
self.inner_pool.report_invalid(at, invalid_tx_errors)
}

fn status(&self) -> PoolStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ where
}

// Best effort pool removal (tx can already be finalized).
pool.remove_invalid(&[broadcast_state.tx_hash]);
pool.report_invalid(None, &[(broadcast_state.tx_hash, None)]);
});

// Keep track of this entry and the abortable handle.
Expand Down
6 changes: 3 additions & 3 deletions substrate/client/rpc/src/author/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,17 @@ where
let hashes = bytes_or_hash
.into_iter()
.map(|x| match x {
hash::ExtrinsicOrHash::Hash(h) => Ok(h),
hash::ExtrinsicOrHash::Hash(h) => Ok((h, None)),
hash::ExtrinsicOrHash::Extrinsic(bytes) => {
let xt = Decode::decode(&mut &bytes[..])?;
Ok(self.pool.hash_of(&xt))
Ok((self.pool.hash_of(&xt), None))
},
})
.collect::<Result<Vec<_>>>()?;

Ok(self
.pool
.remove_invalid(&hashes)
.report_invalid(None, &hashes)
.into_iter()
.map(|tx| tx.hash().clone())
.collect())
Expand Down

0 comments on commit bf2dd1f

Please sign in to comment.