mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
txpool: TestApi best_block fix (#12992)
This is a minor clean up. There was a minor bug in TestApi::add_block: the best block flag for given number was not cleared when the new best block with the same number was added. The usage of is_best_block argument in add_block method in txpool tests were aligned with the BestBlock event.
This commit is contained in:
committed by
GitHub
parent
4dc62d7e71
commit
a1a9dff12c
@@ -178,6 +178,18 @@ impl TestApi {
|
||||
|
||||
let mut chain = self.chain.write();
|
||||
chain.block_by_hash.insert(hash, block.clone());
|
||||
|
||||
if is_best_block {
|
||||
chain
|
||||
.block_by_number
|
||||
.entry(*block_number)
|
||||
.or_default()
|
||||
.iter_mut()
|
||||
.for_each(|x| {
|
||||
x.1 = IsBestBlock::No;
|
||||
});
|
||||
}
|
||||
|
||||
chain
|
||||
.block_by_number
|
||||
.entry(*block_number)
|
||||
|
||||
Reference in New Issue
Block a user