Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
WIP: Validation: Remove ConnectTrace and PerBlockConnectTrace #17562
Builds on #17477. Please review that PR first.
The only CValidationInterface client that cares about transactions that are removed from the mempool because of CONFLICT is the wallet. Start using the TransactionRemovedFromMempool method to notify about conflicted transactions instead of using the vtxConflicted vector in BlockConnected.
The wallet now uses TransactionRemovedFromMempool to be notified about conflicted wallet, and no other clients use vtxConflicted.
Since we don't add a vtxConflicte vector to BlockConnected the conflictedTxs member of PerBlockConnectTrace is no longer used.
ConnectTrace used to subscribe to the mempool's NotifyEntryRemoved callback to be notified of transactions removed for conflict. Since PerBlockConnectTrace no longer tracks conflicted transactions, ConnectTrace no longer requires these notifications.
NotifyEntryAdded never had any subscribers so can be removed. Since ConnectTrace no longer subscribes to NotifyEntryRemoved, there are now no subscribers. The CValidationInterface TransactionAddedToMempool and TransactionRemovedFromMempool methods can now provide this functionality. There's no need for a special notifications framework for the mempool.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
ariard left a comment
Not sure about the wording of commit message,
ConnectTrace was introduced in 6fdd43b when the SyncTransactions signal needed to be fired outside the cs_main scope. The CValidationInterface is now asynchronous and callbacks can be scheduled without holding cs_main. The scheduler thread can execute the callback later without regard to cs_main. Remove the ConnectTrace struct that needs to be passed up and down the stack and just fire BlockConnected() directly in ConnectTip().