Skip to content

Commit

Permalink
test: disallow sendtoaddress/sendmany when private keys disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatack authored and achow101 committed Feb 16, 2021
1 parent 0997019 commit 6bfbc97
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/functional/wallet_watchonly.py
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test createwallet arguments.
"""Test createwallet watchonly arguments.
"""

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

self.log.info('Test sending from a watch-only wallet raises RPC error')
msg = "Error: Private keys are disabled for this wallet"
assert_raises_rpc_error(-4, msg, wo_wallet.sendtoaddress, a1, 0.1)
assert_raises_rpc_error(-4, msg, wo_wallet.sendmany, amounts={a1: 0.1})

self.log.info('Testing listreceivedbyaddress watch-only defaults')
result = wo_wallet.listreceivedbyaddress()
assert_equal(len(result), 1)
Expand Down

0 comments on commit 6bfbc97

Please sign in to comment.