From fac07f2038a3ccd5edadc6e6122c02fa30e697bd Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 8 Nov 2019 10:29:41 -0500 Subject: node: Add reference to mempool in NodeContext 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. --- src/rpc/blockchain.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/rpc/blockchain.h') diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h index 8a1264f824..ccb3e39722 100644 --- a/src/rpc/blockchain.h +++ b/src/rpc/blockchain.h @@ -52,4 +52,6 @@ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], //! direct way to pass in state to RPC methods without globals. extern NodeContext* g_rpc_node; +CTxMemPool& EnsureMemPool(); + #endif -- cgit v1.2.3