From d9e2183c50f50465b9f173171fee240949bf8bd2 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Sun, 9 May 2021 22:22:19 +0900 Subject: rpc: include OBJ_USER_KEY in RPCArg constructor checks --- src/rpc/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rpc/util.h b/src/rpc/util.h index 8ec18b2f35..06381d504c 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -173,7 +173,7 @@ struct RPCArg { m_oneline_description{std::move(oneline_description)}, m_type_str{std::move(type_str)} { - CHECK_NONFATAL(type != Type::ARR && type != Type::OBJ); + CHECK_NONFATAL(type != Type::ARR && type != Type::OBJ && type != Type::OBJ_USER_KEYS); } RPCArg( @@ -193,7 +193,7 @@ struct RPCArg { m_oneline_description{std::move(oneline_description)}, m_type_str{std::move(type_str)} { - CHECK_NONFATAL(type == Type::ARR || type == Type::OBJ); + CHECK_NONFATAL(type == Type::ARR || type == Type::OBJ || type == Type::OBJ_USER_KEYS); } bool IsOptional() const; -- cgit v1.2.3 From 8500f7bf54d3e27fd2fa7fda15ad833f5688c331 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Sun, 9 May 2021 21:52:55 +0900 Subject: rpc/createrawtransaction: redefine addresses as OBJ_USER_KEYS The OBJ type is for actual objects with defined keys; OBJ_USER_KEYS is for objects with user-defined keys (such as the bitcoin address(es) in the createrawtransaction output object. --- src/rpc/rawtransaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 16ca3bb47d..186a77385a 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -397,7 +397,7 @@ static RPCHelpMan createrawtransaction() "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" " accepted as second parameter.", { - {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "", + {"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "", { {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT}, }, -- cgit v1.2.3 From 7031721f2cc3eef30c46ff50c52328e9ba8090e0 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Sun, 9 May 2021 21:54:40 +0900 Subject: rpc/listaddressgroupings: redefine inner-most array as ARR_FIXED ARR_FIXED is for cases like this, where the elements are in an array for convenience, rather than due to being dynamically sized lists. --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 67d9d56133..ae337055e2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -540,7 +540,7 @@ static RPCHelpMan listaddressgroupings() { {RPCResult::Type::ARR, "", "", { - {RPCResult::Type::ARR, "", "", + {RPCResult::Type::ARR_FIXED, "", "", { {RPCResult::Type::STR, "address", "The bitcoin address"}, {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT}, -- cgit v1.2.3