Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't update mempool in handle_new_tip if the actual chainstate tip differs #1507

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

ImplOfAnImpl
Copy link
Contributor

No description provided.

Comment on lines 165 to 177
// We still need to update the current tx_verifier tip
let mut old_transactions = mempool.reset();
if old_transactions.next().is_some() {
log::warn!("Discarding mempool transactions during IBD");
log::warn!("Discarding mempool transactions during IBD or because the tip has changed");
}
return Ok(());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, is this needed when the tip is out of sync? Why was it needed in the ibd case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the IBD case, if the IBD correctly behaves as a latch, it should not happen. I just found it a bit risky to go for a full assertion. I would say dropping transactions from mempool is not appropriate when mempool is temporarily out of sync. However, when mempool catches up, it should reset() and reverify to see which transactions still apply at the current tip.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turned out that some functional tests do depend on this "mempool.reset" during ibd, so I left this call under "if is_ibd" and wrote a comment.

@ImplOfAnImpl ImplOfAnImpl force-pushed the dont_update_mempool_if_tip_differs branch from 7c23c17 to 9f0b495 Compare January 26, 2024 17:48
@TheQuantumPhysicist TheQuantumPhysicist merged commit 1f8d076 into master Jan 26, 2024
27 checks passed
@TheQuantumPhysicist TheQuantumPhysicist deleted the dont_update_mempool_if_tip_differs branch January 26, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants