Skip to content

Commit 809d66b

Browse files
committed
rpc: clarify getblockfrompeer behavior when called multiple times
1 parent 0e3d7c5 commit 809d66b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/net_processing.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,9 @@ bool PeerManagerImpl::FetchBlock(NodeId id, const CBlockIndex& block_index)
14391439
// Ignore pre-segwit peers
14401440
if (!state->fHaveWitness) return false;
14411441

1442-
// Mark block as in-flight unless it already is
1442+
// Mark block as in-flight unless it already is (for this peer).
1443+
// If a block was already in-flight for a different peer, its BLOCKTXN
1444+
// response will be dropped.
14431445
if (!BlockRequested(id, block_index)) return false;
14441446

14451447
// Construct message to request the block

src/rpc/blockchain.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ static RPCHelpMan getblockfrompeer()
781781
"getblockfrompeer",
782782
"\nAttempt to fetch block from a given peer.\n"
783783
"\nWe must have the header for this block, e.g. using submitheader.\n"
784-
"\nReturns {} if a block-request was successfully scheduled\n",
784+
"Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n"
785+
"\nReturns an empty JSON object if the request was successfully scheduled.",
785786
{
786787
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash"},
787788
{"nodeid", RPCArg::Type::NUM, RPCArg::Optional::NO, "The node ID (see getpeerinfo for node IDs)"},

0 commit comments

Comments
 (0)