HomePhabricator

node: Add reference to mempool in NodeContext

Description

node: Add reference to mempool in NodeContext

Summary:
Currently it is an alias to the global ::mempool and should be used as
follows.

  • Node code (validation and transaction relay) can use either ::mempool or node.mempool, whichever seems a better fit.
  • RPC code should use the added convenience getter EnsureMempool, which makes sure the mempool exists before use. This prepares the RPC code to a future where the mempool might be disabled at runtime or compile time.
  • Test code should use m_node.mempool directly, as the mempool is always initialized for tests.

This is a partial backport of Core PR17407 : https://github.com/bitcoin/bitcoin/pull/17407/commits/fac07f2038a3ccd5edadc6e6122c02fa30e697bd

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D6437

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Nov 8 2019, 15:29
deadalnixCommitted on Jun 8 2020, 02:55
deadalnixPushed on Jun 8 2020, 02:55
Reviewer
Restricted Project
Differential Revision
D6437: node: Add reference to mempool in NodeContext
Parents
rABCde9e8eb0ecd4: Check that tx_relay is initialized before access
Branches
Unknown
Tags
Unknown