mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 20:47:56 +00:00
Limit transaction pool size (#1676)
* Avoid excessive hashing. Store extrinsic len. * Implement pool limits. * Fix issues. * Make sure we return error in case it doesn't make into the pool. * Pass parameters from CLI. * Remove redundant todo. * Fix tests.
This commit is contained in:
@@ -75,7 +75,9 @@ impl<T, Block> txpool::ChainApi for ChainApi<T, Block> where
|
||||
Ok(self.client.block_hash_from_id(at)?)
|
||||
}
|
||||
|
||||
fn hash(&self, ex: &txpool::ExtrinsicFor<Self>) -> Self::Hash {
|
||||
Blake2Hasher::hash(&ex.encode())
|
||||
fn hash_and_length(&self, ex: &txpool::ExtrinsicFor<Self>) -> (Self::Hash, usize) {
|
||||
ex.using_encoded(|x| {
|
||||
(Blake2Hasher::hash(x), x.len())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user