Skip to content

Mempool state is now an enum of InIbd/AfterIbd#2010

Merged
ImplOfAnImpl merged 1 commit intomasterfrom
mempool_avoid_calling_chainstate_during_ibd
Feb 12, 2026
Merged

Mempool state is now an enum of InIbd/AfterIbd#2010
ImplOfAnImpl merged 1 commit intomasterfrom
mempool_avoid_calling_chainstate_during_ibd

Conversation

@ImplOfAnImpl
Copy link
Contributor

Currently, even though mempool is not supposed to accept transactions during initial block download, this is not enforced on the type level, so every time a new tip is received during ibd, TxPool has to be explicitly reset, just in case. This creates useless and potentially significant overhead, because resetting TxPool requires a few calls to chainstate, which may be particularly slow during ibd due to chainstate being under stress. Additionally, in order to check for ibd, mempool has to first call chainstate as well.

In this PR:

  • ChainstateEvent::NewTip now also contains the is_initial_block_download flag, so that the mempool doesn't have to call chainstate for this;
  • Mempoo's state is now an enum consisting of two variants - InIbd and AfterIbd. The latter is the "normal" mempool and the former is a temporary state that contains settings and also tracks the current best block id (needed by the implementation of MempoolInterface).

…ke higher-level mempool object an enum, so that tx pool and orphans pool only come to existence once it's out of ibd.
Base automatically changed from p2p_check_block_existence_in_separate_cs_call to master February 12, 2026 12:30
@ImplOfAnImpl ImplOfAnImpl merged commit 493c639 into master Feb 12, 2026
14 checks passed
@ImplOfAnImpl ImplOfAnImpl deleted the mempool_avoid_calling_chainstate_during_ibd branch February 12, 2026 12: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.

2 participants