mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
Fix transaction pruning in tx-pool (#6276)
The `tree_route` generated by the import notification is only from the old best block to the new best parent. This means, it does not contain the new best block in `enacted()`. We need to prune the transactions of the new best block "manually" to fix this bug. Besides that, this pr also changed the `id` parameter of the `NewBlock` chain event to `hash`. The hash of a block is unique in contrast to the block number. (Block id can either be number or hash)
This commit is contained in:
@@ -55,7 +55,7 @@ use std::{
|
||||
};
|
||||
use wasm_timer::SystemTime;
|
||||
use sc_telemetry::{telemetry, SUBSTRATE_INFO};
|
||||
use sp_transaction_pool::{MaintainedTransactionPool, ChainEvent};
|
||||
use sp_transaction_pool::MaintainedTransactionPool;
|
||||
use prometheus_endpoint::Registry;
|
||||
use sc_client_db::{Backend, DatabaseSettings};
|
||||
use sp_core::traits::CodeExecutor;
|
||||
@@ -1042,14 +1042,9 @@ ServiceBuilder<
|
||||
{
|
||||
let txpool = Arc::downgrade(&transaction_pool);
|
||||
|
||||
let mut import_stream = client.import_notification_stream().map(|n| ChainEvent::NewBlock {
|
||||
id: BlockId::Hash(n.hash),
|
||||
header: n.header,
|
||||
tree_route: n.tree_route,
|
||||
is_new_best: n.is_new_best,
|
||||
}).fuse();
|
||||
let mut import_stream = client.import_notification_stream().map(Into::into).fuse();
|
||||
let mut finality_stream = client.finality_notification_stream()
|
||||
.map(|n| ChainEvent::Finalized::<TBl> { hash: n.hash })
|
||||
.map(Into::into)
|
||||
.fuse();
|
||||
|
||||
let events = async move {
|
||||
|
||||
Reference in New Issue
Block a user