mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +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:
@@ -208,6 +208,8 @@ pub type AccountSignature = sr25519::Signature;
|
||||
pub type AccountId = <AccountSignature as Verify>::Signer;
|
||||
/// A simple hash type for all our hashing.
|
||||
pub type Hash = H256;
|
||||
/// The hashing algorithm used.
|
||||
pub type Hashing = BlakeTwo256;
|
||||
/// The block number type used in this runtime.
|
||||
pub type BlockNumber = u64;
|
||||
/// Index of a transaction.
|
||||
@@ -219,7 +221,7 @@ pub type Digest = sp_runtime::generic::Digest<H256>;
|
||||
/// A test block.
|
||||
pub type Block = sp_runtime::generic::Block<Header, Extrinsic>;
|
||||
/// A test block's header.
|
||||
pub type Header = sp_runtime::generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type Header = sp_runtime::generic::Header<BlockNumber, Hashing>;
|
||||
|
||||
/// Run whatever tests we have.
|
||||
pub fn run_tests(mut input: &[u8]) -> Vec<u8> {
|
||||
@@ -404,7 +406,7 @@ impl frame_system::Trait for Runtime {
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Hashing = Hashing;
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
@@ -466,7 +468,7 @@ fn code_using_trie() -> u64 {
|
||||
let mut root = sp_std::default::Default::default();
|
||||
let _ = {
|
||||
let v = &pairs;
|
||||
let mut t = TrieDBMut::<BlakeTwo256>::new(&mut mdb, &mut root);
|
||||
let mut t = TrieDBMut::<Hashing>::new(&mut mdb, &mut root);
|
||||
for i in 0..v.len() {
|
||||
let key: &[u8]= &v[i].0;
|
||||
let val: &[u8] = &v[i].1;
|
||||
@@ -477,7 +479,7 @@ fn code_using_trie() -> u64 {
|
||||
t
|
||||
};
|
||||
|
||||
if let Ok(trie) = TrieDB::<BlakeTwo256>::new(&mdb, &root) {
|
||||
if let Ok(trie) = TrieDB::<Hashing>::new(&mdb, &root) {
|
||||
if let Ok(iter) = trie.iter() {
|
||||
let mut iter_pairs = Vec::new();
|
||||
for pair in iter {
|
||||
|
||||
Reference in New Issue
Block a user