Skip to content

Commit

Permalink
rpc: clarify getblockfrompeer behavior when called multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Dec 24, 2021
1 parent 0e3d7c5 commit 809d66b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/net_processing.cpp
Expand Up @@ -1439,7 +1439,9 @@ bool PeerManagerImpl::FetchBlock(NodeId id, const CBlockIndex& block_index)
// Ignore pre-segwit peers
if (!state->fHaveWitness) return false;

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

// Construct message to request the block
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/blockchain.cpp
Expand Up @@ -781,7 +781,8 @@ static RPCHelpMan getblockfrompeer()
"getblockfrompeer",
"\nAttempt to fetch block from a given peer.\n"
"\nWe must have the header for this block, e.g. using submitheader.\n"
"\nReturns {} if a block-request was successfully scheduled\n",
"Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n"
"\nReturns an empty JSON object if the request was successfully scheduled.",
{
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash"},
{"nodeid", RPCArg::Type::NUM, RPCArg::Optional::NO, "The node ID (see getpeerinfo for node IDs)"},
Expand Down

0 comments on commit 809d66b

Please sign in to comment.