Fix: stop ignoring updates to newly initialized mempools (#6448)

This commit is contained in:
teor 2023-04-04 03:57:56 +10:00 committed by GitHub
parent 3b259b1746
commit f92db25f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -319,14 +319,11 @@ impl Service<Request> for Mempool {
let tip_action = self.chain_tip_change.last_tip_change();
// If the mempool was just freshly enabled,
// skip resetting and removing mined transactions for this tip.
if is_state_changed {
return Poll::Ready(Ok(()));
}
// Clear the mempool and cancel downloads if there has been a chain tip reset.
if matches!(tip_action, Some(TipAction::Reset { .. })) {
//
// But if the mempool was just freshly enabled,
// skip resetting and removing mined transactions for this tip.
if !is_state_changed && matches!(tip_action, Some(TipAction::Reset { .. })) {
info!(
tip_height = ?tip_action.as_ref().unwrap().best_tip_height(),
"resetting mempool: switched best chain, skipped blocks, or activated network upgrade"