Skip to content

Commit 6bfbc97

Browse files
jonatackachow101
authored andcommitted
test: disallow sendtoaddress/sendmany when private keys disabled
1 parent 0997019 commit 6bfbc97

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: test/functional/wallet_watchonly.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2018-2019 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.
5-
"""Test createwallet arguments.
5+
"""Test createwallet watchonly arguments.
66
"""
77

88
from test_framework.test_framework import BitcoinTestFramework
@@ -49,6 +49,11 @@ def run_test(self):
4949
assert_equal(len(wo_wallet.listtransactions()), 1)
5050
assert_equal(wo_wallet.getbalance(include_watchonly=False), 0)
5151

52+
self.log.info('Test sending from a watch-only wallet raises RPC error')
53+
msg = "Error: Private keys are disabled for this wallet"
54+
assert_raises_rpc_error(-4, msg, wo_wallet.sendtoaddress, a1, 0.1)
55+
assert_raises_rpc_error(-4, msg, wo_wallet.sendmany, amounts={a1: 0.1})
56+
5257
self.log.info('Testing listreceivedbyaddress watch-only defaults')
5358
result = wo_wallet.listreceivedbyaddress()
5459
assert_equal(len(result), 1)

0 commit comments

Comments
 (0)