mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +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:
@@ -413,9 +413,10 @@ mod tests {
|
||||
assert!(client.header(&BlockId::Number(0)).unwrap().is_some());
|
||||
assert!(pool.submit_one(&BlockId::Number(1), SOURCE, uxt(Alice, 1)).await.is_ok());
|
||||
|
||||
let header = client.header(&BlockId::Number(1)).expect("db error").expect("imported above");
|
||||
pool.maintain(sp_transaction_pool::ChainEvent::NewBlock {
|
||||
id: BlockId::Number(1),
|
||||
header: client.header(&BlockId::Number(1)).expect("db error").expect("imported above"),
|
||||
hash: header.hash(),
|
||||
header,
|
||||
is_new_best: true,
|
||||
tree_route: None,
|
||||
}).await;
|
||||
|
||||
Reference in New Issue
Block a user