diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-01-24 14:00:57 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-03-12 09:23:56 -0400 |
commit | fa7fea3654203bf7e7bd504589dd564af7fc749d (patch) | |
tree | 4e2987ec25b64618340af4afd61638038e96fb66 /src/init.cpp | |
parent | 309b0c4c19319a8e0fd3fd7ff82ef9ebb2803072 (diff) |
refactor: Remove mempool global from net
This refactor does two things:
* Pass mempool in to PeerLogicValidation
* Pass m_mempool around where needed
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp index a637aac4d2..97640b0658 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1329,8 +1329,12 @@ bool AppInitMain(NodeContext& node) node.banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", &uiInterface, gArgs.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME)); assert(!node.connman); node.connman = std::unique_ptr<CConnman>(new CConnman(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max()))); + // Make mempool generally available in the node context. For example the connection manager, wallet, or RPC threads, + // which are all started after this, may use it from the node context. + assert(!node.mempool); + node.mempool = &::mempool; - node.peer_logic.reset(new PeerLogicValidation(node.connman.get(), node.banman.get(), *node.scheduler)); + node.peer_logic.reset(new PeerLogicValidation(node.connman.get(), node.banman.get(), *node.scheduler, *node.mempool)); RegisterValidationInterface(node.peer_logic.get()); // sanitize comments per BIP-0014, format user agent and check total size @@ -1678,11 +1682,6 @@ bool AppInitMain(NodeContext& node) return false; } - // Now that the chain state is loaded, make mempool generally available in the node context. For example the - // connection manager, wallet, or RPC threads, which are all started after this, may use it from the node context. - assert(!node.mempool); - node.mempool = &::mempool; - fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; CAutoFile est_filein(fsbridge::fopen(est_path, "rb"), SER_DISK, CLIENT_VERSION); // Allowed to fail as this file IS missing on first startup. |