mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Make transaction pool prune transactions only of canonical blocks (#6123)
* Make tx pool aware of retracted fork blocks * Make it compile * Update client/transaction-pool/src/lib.rs Co-authored-by: Nikolay Volf <nikvolf@gmail.com> * Fix doc test * Simplify the implementation * Send tree route as arc to prevent heavy clones * Switch to use `ExtrinsicHash` to make it more clear * Fix benchmark Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -331,15 +331,14 @@ mod tests {
|
||||
use parking_lot::Mutex;
|
||||
use sp_consensus::{BlockOrigin, Proposer};
|
||||
use substrate_test_runtime_client::{
|
||||
prelude::*,
|
||||
runtime::{Extrinsic, Transfer},
|
||||
prelude::*, TestClientBuilder, runtime::{Extrinsic, Transfer}, TestClientBuilderExt,
|
||||
};
|
||||
use sp_transaction_pool::{ChainEvent, MaintainedTransactionPool, TransactionSource};
|
||||
use sc_transaction_pool::{BasicPool, FullChainApi};
|
||||
use sp_api::Core;
|
||||
use backend::Backend;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_runtime::traits::NumberFor;
|
||||
use sc_client_api::Backend;
|
||||
|
||||
const SOURCE: TransactionSource = TransactionSource::External;
|
||||
|
||||
@@ -357,7 +356,7 @@ mod tests {
|
||||
{
|
||||
ChainEvent::NewBlock {
|
||||
id: BlockId::Number(block_number.into()),
|
||||
retracted: vec![],
|
||||
tree_route: None,
|
||||
is_new_best: true,
|
||||
header,
|
||||
}
|
||||
@@ -452,8 +451,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn proposed_storage_changes_should_match_execute_block_storage_changes() {
|
||||
let (client, backend) = substrate_test_runtime_client::TestClientBuilder::new()
|
||||
.build_with_backend();
|
||||
let (client, backend) = TestClientBuilder::new().build_with_backend();
|
||||
let client = Arc::new(client);
|
||||
let txpool = Arc::new(
|
||||
BasicPool::new(
|
||||
@@ -473,7 +471,9 @@ mod tests {
|
||||
futures::executor::block_on(
|
||||
txpool.maintain(chain_event(
|
||||
0,
|
||||
client.header(&BlockId::Number(0u64)).expect("header get error").expect("there should be header")
|
||||
client.header(&BlockId::Number(0u64))
|
||||
.expect("header get error")
|
||||
.expect("there should be header"),
|
||||
))
|
||||
);
|
||||
|
||||
@@ -500,8 +500,11 @@ mod tests {
|
||||
backend.changes_trie_storage(),
|
||||
).unwrap();
|
||||
|
||||
let storage_changes = api.into_storage_changes(&state, changes_trie_state.as_ref(), genesis_hash)
|
||||
.unwrap();
|
||||
let storage_changes = api.into_storage_changes(
|
||||
&state,
|
||||
changes_trie_state.as_ref(),
|
||||
genesis_hash,
|
||||
).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
proposal.storage_changes.transaction_storage_root,
|
||||
|
||||
Reference in New Issue
Block a user