MCPcopy Create free account
hub / github.com/ElementsProject/elements / PushNodeVersion

Method PushNodeVersion

src/net_processing.cpp:1134–1160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1132} // namespace
1133
1134void PeerManagerImpl::PushNodeVersion(CNode& pnode)
1135{
1136 // Note that pnode->GetLocalServices() is a reflection of the local
1137 // services we were offering when the CNode object was created for this
1138 // peer.
1139 uint64_t my_services{pnode.GetLocalServices()};
1140 const int64_t nTime{count_seconds(GetTime<std::chrono::seconds>())};
1141 uint64_t nonce = pnode.GetLocalNonce();
1142 const int nNodeStartingHeight{m_best_height};
1143 NodeId nodeid = pnode.GetId();
1144 CAddress addr = pnode.addr;
1145
1146 CService addr_you = addr.IsRoutable() && !IsProxy(addr) && addr.IsAddrV1Compatible() ? addr : CService();
1147 uint64_t your_services{addr.nServices};
1148
1149 const bool tx_relay = !m_ignore_incoming_txs && pnode.m_tx_relay != nullptr && !pnode.IsFeelerConn();
1150 m_connman.PushMessage(&pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERSION, PROTOCOL_VERSION, my_services, nTime,
1151 your_services, addr_you, // Together the pre-version-31402 serialization of CAddress "addrYou" (without nTime)
1152 my_services, CService(), // Together the pre-version-31402 serialization of CAddress "addrMe" (without nTime)
1153 nonce, strSubVersion, nNodeStartingHeight, tx_relay));
1154
1155 if (fLogIPs) {
1156 LogPrint(BCLog::NET, "send version message: version %d, blocks=%d, them=%s, txrelay=%d, peer=%d\n", PROTOCOL_VERSION, nNodeStartingHeight, addr_you.ToString(), tx_relay, nodeid);
1157 } else {
1158 LogPrint(BCLog::NET, "send version message: version %d, blocks=%d, txrelay=%d, peer=%d\n", PROTOCOL_VERSION, nNodeStartingHeight, tx_relay, nodeid);
1159 }
1160}
1161
1162void PeerManagerImpl::AddTxAnnouncement(const CNode& node, const GenTxid& gtxid, std::chrono::microseconds current_time)
1163{

Callers

nothing calls this directly

Calls 13

count_secondsFunction · 0.85
IsProxyFunction · 0.85
CNetMsgMakerClass · 0.85
GetLocalNonceMethod · 0.80
GetIdMethod · 0.80
IsRoutableMethod · 0.80
IsAddrV1CompatibleMethod · 0.80
IsFeelerConnMethod · 0.80
PushMessageMethod · 0.80
CServiceClass · 0.70
GetLocalServicesMethod · 0.45
MakeMethod · 0.45

Tested by

no test coverage detected