Skip to content

Commit 17c24d4

Browse files
committed
[init] Add netgroupman to node.context
This is constructed before addrman and connman, and destructed afterwards. netgroupman does not currently do anything, but will have functionality added in future commits.
1 parent 9b38367 commit 17c24d4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/init.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <net_permissions.h>
3434
#include <net_processing.h>
3535
#include <netbase.h>
36+
#include <netgroup.h>
3637
#include <node/blockstorage.h>
3738
#include <node/caches.h>
3839
#include <node/chainstate.h>
@@ -240,6 +241,7 @@ void Shutdown(NodeContext& node)
240241
node.connman.reset();
241242
node.banman.reset();
242243
node.addrman.reset();
244+
node.netgroupman.reset();
243245

244246
if (node.mempool && node.mempool->IsLoaded() && node.args->GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
245247
DumpMempool(*node.mempool);
@@ -1229,8 +1231,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
12291231
const bool ignores_incoming_txs{args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)};
12301232

12311233
{
1232-
// Initialize addrman
1233-
assert(!node.addrman);
12341234

12351235
// Read asmap file if configured
12361236
std::vector<bool> asmap;
@@ -1254,6 +1254,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
12541254
LogPrintf("Using /16 prefix for IP bucketing\n");
12551255
}
12561256

1257+
// Initialize netgroup manager
1258+
assert(!node.netgroupman);
1259+
node.netgroupman = std::make_unique<NetGroupManager>();
1260+
1261+
// Initialize addrman
1262+
assert(!node.addrman);
12571263
uiInterface.InitMessage(_("Loading P2P addresses…").translated);
12581264
if (const auto error{LoadAddrman(asmap, args, node.addrman)}) {
12591265
return InitError(*error);

src/node/context.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <interfaces/chain.h>
1010
#include <net.h>
1111
#include <net_processing.h>
12+
#include <netgroup.h>
1213
#include <policy/fees.h>
1314
#include <scheduler.h>
1415
#include <txmempool.h>

src/node/context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class CConnman;
1818
class CScheduler;
1919
class CTxMemPool;
2020
class ChainstateManager;
21+
class NetGroupManager;
2122
class PeerManager;
2223
namespace interfaces {
2324
class Chain;
@@ -43,6 +44,7 @@ struct NodeContext {
4344
std::unique_ptr<AddrMan> addrman;
4445
std::unique_ptr<CConnman> connman;
4546
std::unique_ptr<CTxMemPool> mempool;
47+
std::unique_ptr<const NetGroupManager> netgroupman;
4648
std::unique_ptr<CBlockPolicyEstimator> fee_estimator;
4749
std::unique_ptr<PeerManager> peerman;
4850
std::unique_ptr<ChainstateManager> chainman;

0 commit comments

Comments
 (0)