From f39d9269ebbcffe70d02674c67c4f53783b63005 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Tue, 1 Feb 2022 14:41:36 +0100 Subject: [PATCH] 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: d8b4b49667f3eaf5ac16c218aaba2136ece907d8, 85da07a5a001a563488382435202b74a3e3e964a, a2be3b66b56bccc01dfa2fb992515ae56bbedd49, 3788a8479b4efd481f3e91419bcf347113375112 --- src/net_processing.cpp | 2 ++ src/rpc/blockchain.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 74700580ad..ba6725c74e 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1738,6 +1738,8 @@ std::optional PeerManagerImpl::FetchBlock(NodeId peer_id, const CBl LOCK(cs_main); // Mark block as in-flight unless it already is (for this peer). + // If the peer does not send us a block, vBlocksInFlight remains non-empty, + // causing us to timeout and disconnect. // If a block was already in-flight for a different peer, its BLOCKTXN // response will be dropped. if (!BlockRequested(peer_id, block_index)) return "Already requested from this peer"; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index f57915e805..29fdb25a9f 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -428,7 +428,9 @@ static RPCHelpMan getblockfrompeer() "getblockfrompeer", "Attempt to fetch block from a given peer.\n\n" "We must have the header for this block, e.g. using submitheader.\n" - "Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n\n" + "Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n" + "Peers generally ignore requests for a stale block that they never fully verified, or one that is more than a month old.\n" + "When a peer does not respond with a block, we will disconnect.\n\n" "Returns an empty JSON object if the request was successfully scheduled.", { {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash to try to fetch"},