| 357 | } |
| 358 | |
| 359 | bool 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 | |
| 378 | CNode* CConnman::ConnectNode(CAddress addrConnect, |
| 379 | const char* pszDest, |
no test coverage detected