diff options
author | MacroFake <falke.marco@gmail.com> | 2022-07-12 17:28:23 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-07-12 17:28:26 +0200 |
commit | 46fcb52cb19462c74dceb085b8ca727c47a6ad32 (patch) | |
tree | 51b68471dc9ee06da7579d4b01ca54a49678a858 /src/rpc | |
parent | 7d258ee8bc3bff439881064dd6234f7b04982783 (diff) | |
parent | 2ef5294a5bb68ceb3797d2638567a172cc21699f (diff) | |
download | bitcoin-46fcb52cb19462c74dceb085b8ca727c47a6ad32.tar.xz |
Merge bitcoin/bitcoin#24944: rpc: add getblockfrompeer RPCTypeCheck and invalid input test coverage
2ef5294a5bb68ceb3797d2638567a172cc21699f rpc: add RPCTypeCheck for getblockfrompeer inputs (Jon Atack)
734b9669ff7b2f5e2820993443a6f868f6b0b20a test: add getblockfrompeer coverage of invalid inputs (Jon Atack)
Pull request description:
The new getblockfrompeer RPC lacks test coverage for invalid arguments, and its error messages are not harmonized with the existing RPCs.
Fix all issues.
ACKs for top commit:
brunoerg:
ACK 2ef5294a5bb68ceb3797d2638567a172cc21699f
Tree-SHA512: 454782cf6a44fd0e05483bb152153667ef5c8021358385ddcf89724fbbbd35e187362bdff757e00c99319527bc4c0b20c7187f67241d4585d767a29787142f25
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/blockchain.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 6846e992d4..0db1e4b78f 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -440,6 +440,11 @@ static RPCHelpMan getblockfrompeer() }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + RPCTypeCheck(request.params, { + UniValue::VSTR, // blockhash + UniValue::VNUM, // peer_id + }); + const NodeContext& node = EnsureAnyNodeContext(request.context); ChainstateManager& chainman = EnsureChainman(node); PeerManager& peerman = EnsurePeerman(node); |