Skip to content

mempool: Separate reactor from implementation #1042

@hvanz

Description

@hvanz

Summary

Currently the code of the mempool reactor makes calls directly to CListMempool's methods that are not part of the Mempool interface. A clear separation of concerns will help introduce future improvements to the gossip protocol in the reactor, to modularize the mempool components, and to have multiple mempool implementations if we need to.

Specifically, in the mempool reactor:

  • NewReactor takes a CListMempool as a parameter, instead of an interface Mempool,
  • there are calls to implementation specific methods such as TxsWaitChan and TxsFront for iterating through CListMempool's entries, and also to SetLogger,
  • there are calls to methods NextWaitChan and Next from mempoolTx, which is the data structure used as entries in the list CListMempool.

DoD

  • Define and implement a clear Mempool interface, so that the reactor only interacts with the mempool implementation through the interface methods.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions