Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 3,746 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::VERSION) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"receive version message: [%s] %s: version %d, blocks=%d, " | "receive version message: [%s] %s: version %d, blocks=%d, " | ||||
"us=%s, txrelay=%d, peer=%d%s\n", | "us=%s, txrelay=%d, peer=%d%s\n", | ||||
pfrom.addr.ToString(), cleanSubVer, pfrom.nVersion, | pfrom.addr.ToString(), cleanSubVer, pfrom.nVersion, | ||||
peer->m_starting_height, addrMe.ToString(), fRelay, | peer->m_starting_height, addrMe.ToString(), fRelay, | ||||
pfrom.GetId(), remoteAddr); | pfrom.GetId(), remoteAddr); | ||||
// Ignore time offsets that are improbable (before the Genesis block) | |||||
// and may underflow the nTimeOffset calculation. | |||||
int64_t currentTime = GetTime(); | int64_t currentTime = GetTime(); | ||||
if (nTime >= int64_t(m_chainparams.GenesisBlock().nTime)) { | |||||
int64_t nTimeOffset = nTime - currentTime; | int64_t nTimeOffset = nTime - currentTime; | ||||
pfrom.nTimeOffset = nTimeOffset; | pfrom.nTimeOffset = nTimeOffset; | ||||
AddTimeData(pfrom.addr, nTimeOffset); | if (nTime < int64_t(m_chainparams.GenesisBlock().nTime)) { | ||||
} else { | // Ignore time offsets that are improbable (before the Genesis | ||||
// block) and may underflow our adjusted time. | |||||
Misbehaving(pfrom, 20, | Misbehaving(pfrom, 20, | ||||
"Ignoring invalid timestamp in version message"); | "Ignoring invalid timestamp in version message"); | ||||
} else if (!pfrom.IsInboundConn()) { | |||||
// Don't use timedata samples from inbound peers to make it | |||||
// harder for others to tamper with our adjusted time. | |||||
AddTimeData(pfrom.addr, nTimeOffset); | |||||
} | } | ||||
// Feeler connections exist only to verify if address is online. | // Feeler connections exist only to verify if address is online. | ||||
if (pfrom.IsFeelerConn()) { | if (pfrom.IsFeelerConn()) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"feeler connection completed peer=%d; disconnecting\n", | "feeler connection completed peer=%d; disconnecting\n", | ||||
pfrom.GetId()); | pfrom.GetId()); | ||||
pfrom.fDisconnect = true; | pfrom.fDisconnect = true; | ||||
▲ Show 20 Lines • Show All 3,489 Lines • Show Last 20 Lines |