MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CheckIncomingNonce

Method CheckIncomingNonce

src/net.cpp:359–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359bool CConnman::CheckIncomingNonce(uint64_t nonce)
360{
361 LOCK(m_nodes_mutex);
362 for (const CNode* pnode : m_nodes) {
363 // Omit private broadcast connections from this check to prevent this privacy attack:
364 // - We connect to a peer in an attempt to privately broadcast a transaction. From our
365 // VERSION message the peer deducts that this is a short-lived connection for
366 // broadcasting a transaction, takes our nonce and delays their VERACK.
367 // - The peer starts connecting to (clearnet) nodes and sends them a VERSION message
368 // which contains our nonce. If the peer manages to connect to us we would disconnect.
369 // - Upon a disconnect, the peer knows our clearnet address. They go back to the short
370 // lived privacy broadcast connection and continue with VERACK.
371 if (!pnode->fSuccessfullyConnected && !pnode->IsInboundConn() && !pnode->IsPrivateBroadcastConn() &&
372 pnode->GetLocalNonce() == nonce)
373 return false;
374 }
375 return true;
376}
377
378CNode* CConnman::ConnectNode(CAddress addrConnect,
379 const char* pszDest,

Callers 2

ProcessMessageMethod · 0.80
connman.cppFile · 0.80

Calls 3

IsInboundConnMethod · 0.80
GetLocalNonceMethod · 0.80

Tested by

no test coverage detected