1400 | @@ -1398,7 +1401,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
1401 | ChainstateManager& chainman = *Assert(node.chainman);
1402 |
1403 | assert(!node.peerman);
1404 | - node.peerman = std::make_unique<PeerManager>(chainparams, *node.connman, node.banman.get(),
1405 | + node.peerman = std::make_unique<PeerManager>(chainparams, *node.connman, *node.addrman, node.banman.get(),
1406 | *node.scheduler, chainman, *node.mempool, ignores_incoming_txs);
Here we pass 5 members of node:
*node.connman, *node.addrman, node.banman.get(), *node.scheduler, *node.mempool
What about just passing a pointer to node itself, i.e. store a pointer to the "parent" node class in PeerManager? And have node->ConnMan(), node->AddrMan(), etc getters.
Because net_processing doesn't depend on node/context (and adding that would be a circular dependency between net_processing and node/context). In fact, a NodeContext object isn't even needed to construct a PeerManager object - see denialofservice_tests.cpp.