Skip to content

Commit 3799224

Browse files
committed
Merge bitcoin/bitcoin#30457: doc: getaddressinfo[isscript] is optional
fa6390d doc: getaddressinfo[isscript] is optional (MarcoFalke) Pull request description: `isscript` is unknown for unknown witness versions, so it should be marked optional in the docs Fixes bitcoin/bitcoin#30456 ACKs for top commit: stickies-v: ACK fa6390d tdb3: ACK fa6390d Tree-SHA512: f728f18e0871923225e0bf29594f8095997456cf55409f42087b5f70f95bef10f984323b48d2b484b6705f23b04e9e8a3fe42446830638fdd70453c18fd7f189
2 parents 6f9db1e + fa6390d commit 3799224

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/wallet/rpc/addresses.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2022 The Bitcoin Core developers
1+
// Copyright (c) 2011-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -534,7 +534,7 @@ RPCHelpMan getaddressinfo()
534534
{RPCResult::Type::BOOL, "solvable", "If we know how to spend coins sent to this address, ignoring the possible lack of private keys."},
535535
{RPCResult::Type::STR, "desc", /*optional=*/true, "A descriptor for spending coins sent to this address (only when solvable)."},
536536
{RPCResult::Type::STR, "parent_desc", /*optional=*/true, "The descriptor used to derive this address if this is a descriptor wallet"},
537-
{RPCResult::Type::BOOL, "isscript", "If the key is a script."},
537+
{RPCResult::Type::BOOL, "isscript", /*optional=*/true, "If the key is a script."},
538538
{RPCResult::Type::BOOL, "ischange", "If the address was used for change output."},
539539
{RPCResult::Type::BOOL, "iswitness", "If the address is a witness address."},
540540
{RPCResult::Type::NUM, "witness_version", /*optional=*/true, "The version number of the witness program."},

test/functional/rpc_invalid_address_message.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2020-2022 The Bitcoin Core developers
2+
# Copyright (c) 2020-present The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test error messages for 'getaddressinfo' and 'validateaddress' RPC commands."""
@@ -12,6 +12,7 @@
1212
)
1313

1414
BECH32_VALID = 'bcrt1qtmp74ayg7p24uslctssvjm06q5phz4yrxucgnv'
15+
BECH32_VALID_UNKNOWN_WITNESS = 'bcrt1p424qxxyd0r'
1516
BECH32_VALID_CAPITALS = 'BCRT1QPLMTZKC2XHARPPZDLNPAQL78RSHJ68U33RAH7R'
1617
BECH32_VALID_MULTISIG = 'bcrt1qdg3myrgvzw7ml9q0ejxhlkyxm7vl9r56yzkfgvzclrf4hkpx9yfqhpsuks'
1718

@@ -80,6 +81,7 @@ def test_validateaddress(self):
8081

8182
# Valid Bech32
8283
self.check_valid(BECH32_VALID)
84+
self.check_valid(BECH32_VALID_UNKNOWN_WITNESS)
8385
self.check_valid(BECH32_VALID_CAPITALS)
8486
self.check_valid(BECH32_VALID_MULTISIG)
8587

@@ -109,6 +111,7 @@ def test_getaddressinfo(self):
109111
assert_raises_rpc_error(-5, "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", node.getaddressinfo, BECH32_INVALID_PREFIX)
110112
assert_raises_rpc_error(-5, "Invalid or unsupported Base58-encoded address.", node.getaddressinfo, BASE58_INVALID_PREFIX)
111113
assert_raises_rpc_error(-5, "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", node.getaddressinfo, INVALID_ADDRESS)
114+
assert "isscript" not in node.getaddressinfo(BECH32_VALID_UNKNOWN_WITNESS)
112115

113116
def run_test(self):
114117
self.test_validateaddress()

0 commit comments

Comments
 (0)