MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / PushVersion

Method PushVersion

src/p2p/node.cpp:158–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156void CNode::Cleanup() {}
157
158void CNode::PushVersion() {
159 int32_t nBestHeight = GetNodeSignals().GetHeight().get_value_or(0);
160
161#ifdef WIN32
162 string os("windows");
163#else
164 string os("linux");
165#endif
166 vector<string> comments;
167 comments.push_back(os);
168 /// when NTP implemented, change to just nTime = GetAdjustedTime()
169 int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime());
170 CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0", 0)));
171 CAddress addrMe = GetLocalAddress(&addr);
172 RAND_bytes((uint8_t*)&nLocalHostNonce, sizeof(nLocalHostNonce));
173 LogPrint(BCLog::NET, "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION,
174 nBestHeight, addrMe.ToString(), addrYou.ToString(), addr.ToString());
175
176 PushMessage(NetMsgType::VERSION, PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe, nLocalHostNonce,
177 FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, comments), nBestHeight, true);
178}
179
180map<CNetAddr, int64_t> CNode::setBanned;
181CCriticalSection CNode::cs_setBanned;

Callers 1

ProcessVersionMessageFunction · 0.80

Calls 11

GetAdjustedTimeFunction · 0.85
GetTimeFunction · 0.85
IsProxyFunction · 0.85
GetLocalAddressFunction · 0.85
FormatSubVersionFunction · 0.85
push_backMethod · 0.80
IsRoutableMethod · 0.80
CAddressClass · 0.70
CServiceClass · 0.50
GetHeightMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected