From 923312fbf6a89efde1739da0b7209694d4f892ba Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Fri, 10 Dec 2021 20:12:05 +0700 Subject: rpc: use peer_id, block_hash for FetchBlock --- src/rpc/blockchain.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/rpc/blockchain.cpp') diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 64c852f6a5..7588f01256 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -784,8 +784,8 @@ static RPCHelpMan getblockfrompeer() "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)"}, + {"block_hash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash to try to fetch"}, + {"peer_id", RPCArg::Type::NUM, RPCArg::Optional::NO, "The peer to fetch it from (see getpeerinfo for peer IDs)"}, }, RPCResult{RPCResult::Type::OBJ_EMPTY, "", /*optional=*/ false, "", {}}, RPCExamples{ @@ -798,10 +798,10 @@ static RPCHelpMan getblockfrompeer() ChainstateManager& chainman = EnsureChainman(node); PeerManager& peerman = EnsurePeerman(node); - const uint256& hash{ParseHashV(request.params[0], "hash")}; - const NodeId nodeid{request.params[1].get_int64()}; + const uint256& block_hash{ParseHashV(request.params[0], "block_hash")}; + const NodeId peer_id{request.params[1].get_int64()}; - const CBlockIndex* const index = WITH_LOCK(cs_main, return chainman.m_blockman.LookupBlockIndex(hash);); + const CBlockIndex* const index = WITH_LOCK(cs_main, return chainman.m_blockman.LookupBlockIndex(block_hash);); if (!index) { throw JSONRPCError(RPC_MISC_ERROR, "Block header missing"); @@ -811,7 +811,7 @@ static RPCHelpMan getblockfrompeer() throw JSONRPCError(RPC_MISC_ERROR, "Block already downloaded"); } - if (const auto err{peerman.FetchBlock(nodeid, *index)}) { + if (const auto err{peerman.FetchBlock(peer_id, *index)}) { throw JSONRPCError(RPC_MISC_ERROR, err.value()); } return UniValue::VOBJ; -- cgit v1.2.3