MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / InitializeNode

Method InitializeNode

src/net_processing.cpp:2335–2360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2333}
2334
2335void PeerManagerImpl::InitializeNode(const Config &config, CNode &node,
2336 ServiceFlags our_services) {
2337 NodeId nodeid = node.GetId();
2338 {
2339 LOCK(cs_main);
2340 m_node_states.emplace_hint(m_node_states.end(),
2341 std::piecewise_construct,
2342 std::forward_as_tuple(nodeid),
2343 std::forward_as_tuple(node.IsInboundConn()));
2344 assert(m_txrequest.Count(nodeid) == 0);
2345 }
2346
2347 if (NetPermissions::HasFlag(node.m_permission_flags,
2348 NetPermissionFlags::BloomFilter)) {
2349 our_services = static_cast<ServiceFlags>(our_services | NODE_BLOOM);
2350 }
2351
2352 PeerRef peer = std::make_shared<Peer>(nodeid, our_services, !!m_avalanche);
2353 {
2354 LOCK(m_peer_mutex);
2355 m_peer_map.emplace_hint(m_peer_map.end(), nodeid, peer);
2356 }
2357 if (!node.IsInboundConn()) {
2358 PushNodeVersion(config, node, *peer);
2359 }
2360}
2361
2362void PeerManagerImpl::ReattemptInitialBroadcast(CScheduler &scheduler) {
2363 std::set<TxId> unbroadcast_txids = m_mempool.GetUnbroadcastTxs();

Callers 9

OpenNetworkConnectionMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
AddRandomOutboundPeerMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
fuzz_targetFunction · 0.80
FUZZ_TARGET_INITFunction · 0.80
HandshakeMethod · 0.80
ConnectNodeMethod · 0.80

Calls 4

IsInboundConnMethod · 0.80
GetIdMethod · 0.45
endMethod · 0.45
CountMethod · 0.45

Tested by 7

BOOST_AUTO_TEST_CASEFunction · 0.64
AddRandomOutboundPeerMethod · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64
fuzz_targetFunction · 0.64
FUZZ_TARGET_INITFunction · 0.64
HandshakeMethod · 0.64
ConnectNodeMethod · 0.64