Skip to content

Commit

Permalink
Merge bitcoin#18974: test: Check that invalid witness destinations ca…
Browse files Browse the repository at this point in the history
…n not be imported

facede1 test: Check that invalid witness destinations can not be imported (MarcoFalke)

Pull request description:

ACKs for top commit:
  practicalswift:
    ACK facede1 -- thanks for adding!

Tree-SHA512: 87000606fac2e6f2780ca75cdeeb2dc1f0528d9b8f13e4156e8304ce7a6b1eb014781b6f0c59d11544bf360ba3dc5f99549470b0876132e189b9107f2c6bb38d
  • Loading branch information
MarcoFalke authored and knst committed Mar 8, 2024
1 parent b2258ab commit 6668e21
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/functional/wallet_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,33 @@ def run_test(self):
# 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')
VALID = {
'✔️_a1': 'yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4',
'✔️_a2': 'yeMpGzMj3rhtnz48XsfpB8itPHhHtgxLc3',
'✔️_a3': '93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB',
}
INVALID = {
'❌_b1': 'y000000000000000000000000000000000',
'❌_b2': 'y000000000000000000000000000000001',
}
for l in VALID:
ad = 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 INVALID:
ad = INVALID[l]
assert_raises_rpc_error(
-5,
"Invalid Dash address or script",
lambda: wallet_watch_only.importaddress(label=l, rescan=False, address=ad),
)


class Label:
def __init__(self, name):
# Label name
Expand Down

0 comments on commit 6668e21

Please sign in to comment.