Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 929 Lines • ▼ Show 20 Lines | void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CNodeState *state = State(node); | CNodeState *state = State(node); | ||||
if (state) { | if (state) { | ||||
state->m_last_block_announcement = time_in_seconds; | state->m_last_block_announcement = time_in_seconds; | ||||
} | } | ||||
} | } | ||||
static bool IsOutboundDisconnectionCandidate(const CNode &node) { | static bool IsOutboundDisconnectionCandidate(const CNode &node) { | ||||
return !(node.fInbound || node.IsManualConn() || node.fFeeler || | return !(node.fInbound || node.IsManualConn() || node.IsFeelerConn() || | ||||
node.m_addr_fetch); | node.m_addr_fetch); | ||||
} | } | ||||
void PeerLogicValidation::InitializeNode(const Config &config, CNode *pnode) { | void PeerLogicValidation::InitializeNode(const Config &config, CNode *pnode) { | ||||
CAddress addr = pnode->addr; | CAddress addr = pnode->addr; | ||||
std::string addrName = pnode->GetAddrName(); | std::string addrName = pnode->GetAddrName(); | ||||
NodeId nodeid = pnode->GetId(); | NodeId nodeid = pnode->GetId(); | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,585 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::VERSION) { | ||||
bool fRelay = true; | bool fRelay = true; | ||||
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe; | vRecv >> nVersion >> nServiceInt >> nTime >> addrMe; | ||||
nSendVersion = std::min(nVersion, PROTOCOL_VERSION); | nSendVersion = std::min(nVersion, PROTOCOL_VERSION); | ||||
nServices = ServiceFlags(nServiceInt); | nServices = ServiceFlags(nServiceInt); | ||||
if (!pfrom.fInbound) { | if (!pfrom.fInbound) { | ||||
connman.SetServices(pfrom.addr, nServices); | connman.SetServices(pfrom.addr, nServices); | ||||
} | } | ||||
if (!pfrom.fInbound && !pfrom.fFeeler && !pfrom.IsManualConn() && | if (!pfrom.fInbound && !pfrom.IsFeelerConn() && !pfrom.IsManualConn() && | ||||
!HasAllDesirableServiceFlags(nServices)) { | !HasAllDesirableServiceFlags(nServices)) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"peer=%d does not offer the expected services " | "peer=%d does not offer the expected services " | ||||
"(%08x offered, %08x expected); disconnecting\n", | "(%08x offered, %08x expected); disconnecting\n", | ||||
pfrom.GetId(), nServices, | pfrom.GetId(), nServices, | ||||
GetDesirableServiceFlags(nServices)); | GetDesirableServiceFlags(nServices)); | ||||
pfrom.fDisconnect = true; | pfrom.fDisconnect = true; | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::VERSION) { | ||||
AddTimeData(pfrom.addr, nTimeOffset); | AddTimeData(pfrom.addr, nTimeOffset); | ||||
} else { | } else { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Misbehaving(pfrom, 20, | Misbehaving(pfrom, 20, | ||||
"Ignoring invalid timestamp in version message"); | "Ignoring invalid timestamp in version message"); | ||||
} | } | ||||
// Feeler connections exist only to verify if address is online. | // Feeler connections exist only to verify if address is online. | ||||
if (pfrom.fFeeler) { | if (pfrom.IsFeelerConn()) { | ||||
assert(pfrom.fInbound == false); | |||||
pfrom.fDisconnect = true; | pfrom.fDisconnect = true; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
if (pfrom.nVersion == 0) { | if (pfrom.nVersion == 0) { | ||||
// Must have a version message before anything else | // Must have a version message before anything else | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 2,595 Lines • Show Last 20 Lines |