MCPcopy Create free account
hub / github.com/LUX-Core/lux / PushVersion

Method PushVersion

src/net.cpp:519–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519void CNode::PushVersion()
520{
521 int nBestHeight = g_signals.GetHeight().get_value_or(0);
522
523 /// when NTP implemented, change to just nTime = GetAdjustedTime()
524 int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime());
525 CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0"), NODE_NONE));
526 CAddress addrMe = GetLocalAddress(&addr);
527 GetRandBytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
528 if (fLogIPs)
529 LogPrint("net", "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), addrYou.ToString(), id);
530 else
531 LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
532 PushMessage("version", PROTOCOL_VERSION, (uint64_t) nLocalServices, nTime, addrYou, addrMe,
533 nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight, true);
534}
535
536
537banmap_t CNode::setBanned;

Callers 1

ProcessMessageFunction · 0.80

Calls 12

GetAdjustedTimeFunction · 0.85
GetTimeFunction · 0.85
IsProxyFunction · 0.85
GetLocalAddressFunction · 0.85
GetRandBytesFunction · 0.85
LogPrintFunction · 0.85
FormatSubVersionFunction · 0.85
GetHeightMethod · 0.80
IsRoutableMethod · 0.80
CAddressClass · 0.70
CServiceClass · 0.70
ToStringMethod · 0.45

Tested by

no test coverage detected