mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Merge #18974: test: Check that invalid witness destinations can not be imported
facede18a4
test: Check that invalid witness destinations can not be imported (MarcoFalke) Pull request description: ACKs for top commit: practicalswift: ACKfacede18a4
-- thanks for adding! Tree-SHA512: 87000606fac2e6f2780ca75cdeeb2dc1f0528d9b8f13e4156e8304ce7a6b1eb014781b6f0c59d11544bf360ba3dc5f99549470b0876132e189b9107f2c6bb38d
This commit is contained in:
commit
bdedfcf076
1 changed files with 27 additions and 0 deletions
|
@ -134,6 +134,33 @@ class WalletLabelsTest(BitcoinTestFramework):
|
|||
# in the label. This is a no-op.
|
||||
change_label(node, labels[2].addresses[0], labels[2], labels[2])
|
||||
|
||||
self.log.info('Check watchonly labels')
|
||||
node.createwallet(wallet_name='watch_only', disable_private_keys=True, descriptors=False)
|
||||
wallet_watch_only = node.get_wallet_rpc('watch_only')
|
||||
BECH32_VALID = {
|
||||
'✔️_VER15_PROG40': 'bcrt10qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn2cjv3',
|
||||
'✔️_VER16_PROG03': 'bcrt1sqqqqqjq8pdp',
|
||||
'✔️_VER16_PROB02': 'bcrt1sqqqqqjq8pv',
|
||||
}
|
||||
BECH32_INVALID = {
|
||||
'❌_VER15_PROG41': 'bcrt10qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzc7xyq',
|
||||
'❌_VER16_PROB01': 'bcrt1sqqpl9r5c',
|
||||
}
|
||||
for l in BECH32_VALID:
|
||||
ad = BECH32_VALID[l]
|
||||
wallet_watch_only.importaddress(label=l, rescan=False, address=ad)
|
||||
node.generatetoaddress(1, ad)
|
||||
assert_equal(wallet_watch_only.getaddressesbylabel(label=l), {ad: {'purpose': 'receive'}})
|
||||
assert_equal(wallet_watch_only.getreceivedbylabel(label=l), 0)
|
||||
for l in BECH32_INVALID:
|
||||
ad = BECH32_INVALID[l]
|
||||
assert_raises_rpc_error(
|
||||
-5,
|
||||
"Invalid Bitcoin address or script",
|
||||
lambda: wallet_watch_only.importaddress(label=l, rescan=False, address=ad),
|
||||
)
|
||||
|
||||
|
||||
class Label:
|
||||
def __init__(self, name):
|
||||
# Label name
|
||||
|
|
Loading…
Add table
Reference in a new issue