Skip to content

Commit bd09416

Browse files
committed
Avoid leaking the prune height through getdata (fingerprinting countermeasure)
1 parent 27df193 commit bd09416

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/net_processing.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,16 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
10911091
pfrom->fDisconnect = true;
10921092
send = false;
10931093
}
1094+
// Avoid leaking prune-height by never sending blocks below the NODE_NETWORK_LIMITED threshold
1095+
if (send && !pfrom->fWhitelisted && (
1096+
(((pfrom->GetLocalServices() & NODE_NETWORK_LIMITED) == NODE_NETWORK_LIMITED) && ((pfrom->GetLocalServices() & NODE_NETWORK) != NODE_NETWORK) && (chainActive.Tip()->nHeight - mi->second->nHeight > (int)NODE_NETWORK_LIMITED_MIN_BLOCKS + 2 /* add two blocks buffer extension for possible races */) )
1097+
)) {
1098+
LogPrint(BCLog::NET, "Ignore block request below NODE_NETWORK_LIMITED threshold from peer=%d\n", pfrom->GetId());
1099+
1100+
//disconnect node and prevent it from stalling (would otherwise wait for the missing block)
1101+
pfrom->fDisconnect = true;
1102+
send = false;
1103+
}
10941104
// Pruned nodes may have deleted the block, so check whether
10951105
// it's available before trying to send.
10961106
if (send && (mi->second->nStatus & BLOCK_HAVE_DATA))

0 commit comments

Comments
 (0)