mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
net_processing: Move extra service flag into InitializeNode
This commit is contained in:
parent
9133fd69a5
commit
8e06be347c
2 changed files with 7 additions and 7 deletions
|
@ -1790,15 +1790,10 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
|
|||
NodeId id = GetNewNodeId();
|
||||
uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize();
|
||||
|
||||
ServiceFlags nodeServices = nLocalServices;
|
||||
if (NetPermissions::HasFlag(permission_flags, NetPermissionFlags::BloomFilter)) {
|
||||
nodeServices = static_cast<ServiceFlags>(nodeServices | NODE_BLOOM);
|
||||
}
|
||||
|
||||
const bool inbound_onion = std::find(m_onion_binds.begin(), m_onion_binds.end(), addr_bind) != m_onion_binds.end();
|
||||
// The V2Transport transparently falls back to V1 behavior when an incoming V1 connection is
|
||||
// detected, so use it whenever we signal NODE_P2P_V2.
|
||||
const bool use_v2transport(nodeServices & NODE_P2P_V2);
|
||||
const bool use_v2transport(nLocalServices & NODE_P2P_V2);
|
||||
|
||||
CNode* pnode = new CNode(id,
|
||||
std::move(sock),
|
||||
|
@ -1816,7 +1811,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
|
|||
.use_v2transport = use_v2transport,
|
||||
});
|
||||
pnode->AddRef();
|
||||
m_msgproc->InitializeNode(*pnode, nodeServices);
|
||||
m_msgproc->InitializeNode(*pnode, nLocalServices);
|
||||
|
||||
LogPrint(BCLog::NET, "connection from %s accepted\n", addr.ToStringAddrPort());
|
||||
|
||||
|
|
|
@ -1571,6 +1571,11 @@ void PeerManagerImpl::InitializeNode(CNode& node, ServiceFlags our_services)
|
|||
m_node_states.emplace_hint(m_node_states.end(), std::piecewise_construct, std::forward_as_tuple(nodeid), std::forward_as_tuple(node.IsInboundConn()));
|
||||
assert(m_txrequest.Count(nodeid) == 0);
|
||||
}
|
||||
|
||||
if (NetPermissions::HasFlag(node.m_permission_flags, NetPermissionFlags::BloomFilter)) {
|
||||
our_services = static_cast<ServiceFlags>(our_services | NODE_BLOOM);
|
||||
}
|
||||
|
||||
PeerRef peer = std::make_shared<Peer>(nodeid, our_services);
|
||||
{
|
||||
LOCK(m_peer_mutex);
|
||||
|
|
Loading…
Add table
Reference in a new issue