mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
refactor: Remove mempool global from net
This refactor does two things: * Pass mempool in to PeerLogicValidation * Pass m_mempool around where needed
This commit is contained in:
11
src/init.cpp
11
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.
|
||||
|
||||
Reference in New Issue
Block a user