Skip to content

[backport] When disconnecting a block, notify children-first order


This is a backport of ABC D14939.

It may not be terribly useful at the moment since nothing in the node observes txn removals or cares about their order. This MR basically guarantees that notifications to observers happen in children-first order when disconnecting a block and emptying out the mempool. This ensures that observers are easier to code and maintain since they don't have to check if a parent was removed before its child.

Note: Currently there are no observers that receive this signal. This is purely an intellectual exercise as a backport.

In the future should we add a ZMQ publisher for notifying of txn removals, it might be advantageous to merge this MR.

Note 2: No tests could be written for this MR since there is no current way within the codebase or outside of it to observe txn mempool removals. However, I am attaching an adapted test from ABC that depends on a hypothetical pubhashtxmprm (hash tx mempool removal) ZMQ message to arrive in order to test this change in functionality. See attachment:

Test Plan

  • ninja all check-all
Edited by Calin Culianu

Merge request reports