Skip to content

Commit f39d926

Browse files
committed
rpc: warn that nodes ignore requests for old stale blocks
This is an anti-fingerprinting measure. See BlockRequestAllowed in net_processing. It has been around since 2014, but alternative clients might still serve these blocks. See also: d8b4b49, 85da07a, a2be3b6, 3788a84
1 parent 5291933 commit f39d926

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,8 @@ std::optional<std::string> PeerManagerImpl::FetchBlock(NodeId peer_id, const CBl
17381738
LOCK(cs_main);
17391739

17401740
// Mark block as in-flight unless it already is (for this peer).
1741+
// If the peer does not send us a block, vBlocksInFlight remains non-empty,
1742+
// causing us to timeout and disconnect.
17411743
// If a block was already in-flight for a different peer, its BLOCKTXN
17421744
// response will be dropped.
17431745
if (!BlockRequested(peer_id, block_index)) return "Already requested from this peer";

src/rpc/blockchain.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ static RPCHelpMan getblockfrompeer()
428428
"getblockfrompeer",
429429
"Attempt to fetch block from a given peer.\n\n"
430430
"We must have the header for this block, e.g. using submitheader.\n"
431-
"Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n\n"
431+
"Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n"
432+
"Peers generally ignore requests for a stale block that they never fully verified, or one that is more than a month old.\n"
433+
"When a peer does not respond with a block, we will disconnect.\n\n"
432434
"Returns an empty JSON object if the request was successfully scheduled.",
433435
{
434436
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash to try to fetch"},

0 commit comments

Comments
 (0)