Skip to content

Commit 5b3f05b

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#24226: rpc: warn that nodes ignore requests for old stale blocks
f39d926 rpc: warn that nodes ignore requests for old stale blocks (Sjors Provoost) Pull request description: Adds warning to RPC help that `getblockfrompeer` is of little use for stale blocks that are more than a month old. This is an anti-fingerprinting measure. See `BlockRequestAllowed` in `net_processing`. It's been in Bitcoin Core since 2014, introduced in #2910 and later improved to not rely on checkpoints. Older and alternative clients might still serve these blocks, so not throwing an error. Allowing whitelisted nodes to fetch these blocks anyway might be nice. ACKs for top commit: fjahr: Code review ACK f39d926 Tree-SHA512: db88f9f7521289640c5e629c840dda1c2c3ab70d458e9e7136c60fbaeb02acfb36dc093502d83d4c098c331e22aab81bf8f4c4961d805e3bde0f8f3cfe68d968
2 parents 71abee8 + f39d926 commit 5b3f05b

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
@@ -1743,6 +1743,8 @@ std::optional<std::string> PeerManagerImpl::FetchBlock(NodeId peer_id, const CBl
17431743
LOCK(cs_main);
17441744

17451745
// Mark block as in-flight unless it already is (for this peer).
1746+
// If the peer does not send us a block, vBlocksInFlight remains non-empty,
1747+
// causing us to timeout and disconnect.
17461748
// If a block was already in-flight for a different peer, its BLOCKTXN
17471749
// response will be dropped.
17481750
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)