aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-12-11 17:11:20 -0500
committerfanquake <fanquake@gmail.com>2020-01-03 18:37:54 +0800
commit4d7875c55500368336992d66b296ba5ee01c0932 (patch)
treeddc082b4b09c6cbd211bbd6ac588ddbf023af7c5 /src
parentbda2f5b3c9aa4d87e33f7af13f7a1ae5b6b4fa11 (diff)
downloadbitcoin-4d7875c55500368336992d66b296ba5ee01c0932.tar.xz
rpc: require second argument only for scantxoutset start action
The second argument of scanobjects is only required for the start action. Stop and abort actions do not need this. Github-Pull: #17728 Rebased-From: 7d263571bee8c36fbe3c854b69c6f31cf1ee3b9b
Diffstat (limited to 'src')
-rw-r--r--src/rpc/blockchain.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 02717fa80f..ad5be71e21 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -2049,7 +2049,7 @@ UniValue scantxoutset(const JSONRPCRequest& request)
" \"start\" for starting a scan\n"
" \"abort\" for aborting the current scan (returns true when abort was successful)\n"
" \"status\" for progress report (in %) of the current scan"},
- {"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::NO, "Array of scan objects\n"
+ {"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "Array of scan objects. Required for \"start\" action\n"
" Every scan object is either a string descriptor or an object:",
{
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
@@ -2109,6 +2109,11 @@ UniValue scantxoutset(const JSONRPCRequest& request)
if (!reserver.reserve()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Scan already in progress, use action \"abort\" or \"status\"");
}
+
+ if (request.params.size() < 2) {
+ throw JSONRPCError(RPC_MISC_ERROR, "scanobjects argument is required for the start action");
+ }
+
std::set<CScript> needles;
std::map<CScript, std::string> descriptors;
CAmount total_in = 0;