-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where mempool is not cleared of invalid tx
This commit fixes a logical error where a mempool reorg is not being processed when more than one block is added and _no_ blocks are removed. Previously when no blocks were removed, `handle_reorg` would return `BlockAddResult::Ok` - even if multiple blocks were added. This introduced a bug where transactions from the added blocks could be left in the mempool. A test was added to `chain_storage` to ensure a reorg in this case. As a consequence of now forcing a reorg even if no blocks are removed, an additional issue was uncovered with `Mempool::process_reorg` causing a panic when `removed_blocks` was empty. A test has been added to catch this case, and the code refactored to remove calls to `expect` in favor of explicitly handling the `Option`s.
- Loading branch information
Byron Hambly
committed
Aug 27, 2020
1 parent
587e177
commit 3524fc3
Showing
4 changed files
with
130 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters