0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-03 09:56:38 -05:00

Merge bitcoin/bitcoin#25093: doc: Fix incorrect sendmany RPC doc

fa95f2033a doc: Fix incorrect sendmany RPC doc (MarcoFalke)
fa96f93f05 test: Add test for missing and omitted required arg (MarcoFalke)

Pull request description:

  This enables the skipped type check for `sendmany` and fixes the resulting error.

  Also, there is an unrelated test-only commit.

ACKs for top commit:
  fanquake:
    ACK fa95f2033a

Tree-SHA512: 6f9992786472d3927485a34e918db76824cfb60fa96f42cc9c3cdba7074fe08c657bd77cb3e748432161a290f2dcf90bb0ece279904bd274c529119e65fa0959
This commit is contained in:
fanquake 2023-01-17 15:19:07 +00:00
commit ccd3d8d2c0
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
2 changed files with 9 additions and 6 deletions

View file

@ -314,12 +314,11 @@ RPCHelpMan sendtoaddress()
RPCHelpMan sendmany() RPCHelpMan sendmany()
{ {
return RPCHelpMan{"sendmany", return RPCHelpMan{"sendmany",
"\nSend multiple times. Amounts are double-precision floating point numbers." + "Send multiple times. Amounts are double-precision floating point numbers." +
HELP_REQUIRING_PASSPHRASE, HELP_REQUIRING_PASSPHRASE,
{ {
{"dummy", RPCArg::Type::STR, RPCArg::Optional::NO, "Must be set to \"\" for backwards compatibility.", {"dummy", RPCArg::Type::STR, RPCArg::Default{"\"\""}, "Must be set to \"\" for backwards compatibility.",
RPCArgOptions{ RPCArgOptions{
.skip_type_check = true,
.oneline_description = "\"\"", .oneline_description = "\"\"",
}}, }},
{"amounts", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::NO, "The addresses and amounts", {"amounts", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::NO, "The addresses and amounts",

View file

@ -95,15 +95,19 @@ class InvalidAddressErrorMessageTest(BitcoinTestFramework):
self.check_invalid(INVALID_ADDRESS, 'Not a valid Bech32 or Base58 encoding') self.check_invalid(INVALID_ADDRESS, 'Not a valid Bech32 or Base58 encoding')
self.check_invalid(INVALID_ADDRESS_2, 'Not a valid Bech32 or Base58 encoding') self.check_invalid(INVALID_ADDRESS_2, 'Not a valid Bech32 or Base58 encoding')
node = self.nodes[0]
# Missing arg returns the help text
assert_raises_rpc_error(-1, "Return information about the given bitcoin address.", node.validateaddress)
# Explicit None is not allowed for required parameters
assert_raises_rpc_error(-3, "JSON value of type null is not of expected type string", node.validateaddress, None)
def test_getaddressinfo(self): def test_getaddressinfo(self):
node = self.nodes[0] node = self.nodes[0]
assert_raises_rpc_error(-5, "Invalid Bech32 address data size", node.getaddressinfo, BECH32_INVALID_SIZE) assert_raises_rpc_error(-5, "Invalid Bech32 address data size", node.getaddressinfo, BECH32_INVALID_SIZE)
assert_raises_rpc_error(-5, "Not a valid Bech32 or Base58 encoding", node.getaddressinfo, BECH32_INVALID_PREFIX) assert_raises_rpc_error(-5, "Not a valid Bech32 or Base58 encoding", node.getaddressinfo, BECH32_INVALID_PREFIX)
assert_raises_rpc_error(-5, "Invalid prefix for Base58-encoded address", node.getaddressinfo, BASE58_INVALID_PREFIX) assert_raises_rpc_error(-5, "Invalid prefix for Base58-encoded address", node.getaddressinfo, BASE58_INVALID_PREFIX)
assert_raises_rpc_error(-5, "Not a valid Bech32 or Base58 encoding", node.getaddressinfo, INVALID_ADDRESS) assert_raises_rpc_error(-5, "Not a valid Bech32 or Base58 encoding", node.getaddressinfo, INVALID_ADDRESS)
def run_test(self): def run_test(self):