@@ -187,7 +187,7 @@ void Shutdown(NodeContext& node)
187
187
// / Be sure that anything that writes files or flushes caches only does this if the respective
188
188
// / module was initialized.
189
189
util::ThreadRename (" shutoff" );
190
- mempool. AddTransactionsUpdated (1 );
190
+ if (node. mempool ) node. mempool -> AddTransactionsUpdated (1 );
191
191
192
192
StopHTTPRPC ();
193
193
StopREST ();
@@ -231,8 +231,8 @@ void Shutdown(NodeContext& node)
231
231
node.connman .reset ();
232
232
node.banman .reset ();
233
233
234
- if (:: mempool. IsLoaded () && node.args ->GetArg (" -persistmempool" , DEFAULT_PERSIST_MEMPOOL)) {
235
- DumpMempool (:: mempool);
234
+ if (node. mempool && node. mempool -> IsLoaded () && node.args ->GetArg (" -persistmempool" , DEFAULT_PERSIST_MEMPOOL)) {
235
+ DumpMempool (*node. mempool );
236
236
}
237
237
238
238
if (fFeeEstimatesInitialized )
@@ -738,10 +738,7 @@ static void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImp
738
738
return ;
739
739
}
740
740
} // End scope of CImportingNow
741
- if (args.GetArg (" -persistmempool" , DEFAULT_PERSIST_MEMPOOL)) {
742
- LoadMempool (::mempool);
743
- }
744
- ::mempool.SetIsLoaded (!ShutdownRequested ());
741
+ chainman.ActiveChainstate ().LoadMempool (args);
745
742
}
746
743
747
744
/* * Sanity checks
@@ -1054,11 +1051,6 @@ bool AppInitParameterInteraction(const ArgsManager& args)
1054
1051
}
1055
1052
}
1056
1053
1057
- // Checkmempool and checkblockindex default to true in regtest mode
1058
- int ratio = std::min<int >(std::max<int >(args.GetArg (" -checkmempool" , chainparams.DefaultConsistencyChecks () ? 1 : 0 ), 0 ), 1000000 );
1059
- if (ratio != 0 ) {
1060
- mempool.setSanityCheck (1.0 / ratio);
1061
- }
1062
1054
fCheckBlockIndex = args.GetBoolArg (" -checkblockindex" , chainparams.DefaultConsistencyChecks ());
1063
1055
fCheckpointsEnabled = args.GetBoolArg (" -checkpoints" , DEFAULT_CHECKPOINTS_ENABLED);
1064
1056
@@ -1368,10 +1360,18 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
1368
1360
node.banman = MakeUnique<BanMan>(GetDataDir () / " banlist.dat" , &uiInterface, args.GetArg (" -bantime" , DEFAULT_MISBEHAVING_BANTIME));
1369
1361
assert (!node.connman );
1370
1362
node.connman = MakeUnique<CConnman>(GetRand (std::numeric_limits<uint64_t >::max ()), GetRand (std::numeric_limits<uint64_t >::max ()), args.GetBoolArg (" -networkactive" , true ));
1363
+
1371
1364
// Make mempool generally available in the node context. For example the connection manager, wallet, or RPC threads,
1372
1365
// which are all started after this, may use it from the node context.
1373
1366
assert (!node.mempool );
1374
1367
node.mempool = &::mempool;
1368
+ if (node.mempool ) {
1369
+ int ratio = std::min<int >(std::max<int >(args.GetArg (" -checkmempool" , chainparams.DefaultConsistencyChecks () ? 1 : 0 ), 0 ), 1000000 );
1370
+ if (ratio != 0 ) {
1371
+ node.mempool ->setSanityCheck (1.0 / ratio);
1372
+ }
1373
+ }
1374
+
1375
1375
assert (!node.chainman );
1376
1376
node.chainman = &g_chainman;
1377
1377
ChainstateManager& chainman = *Assert (node.chainman );
0 commit comments