diff options
author | Jon Atack <jon@atack.com> | 2021-02-16 20:41:21 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-02-19 12:47:43 +0100 |
commit | 4ef1e4bd407ccf80b2a1d40e946e2ac832e624e5 (patch) | |
tree | 1e209ef17d8c5fa08b684089adc7d2dc01b1ce63 | |
parent | d6b5eb5fcc8e8f7f0ab778f32d49aabf6e04d80d (diff) | |
download | bitcoin-4ef1e4bd407ccf80b2a1d40e946e2ac832e624e5.tar.xz |
test: disallow sendtoaddress/sendmany when private keys disabled
Github-Pull: #21201
Rebased-From: 6bfbc97d716faad38c87603ac6049d222236d623
-rwxr-xr-x | test/functional/wallet_watchonly.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/functional/wallet_watchonly.py b/test/functional/wallet_watchonly.py index b0c41b2738..2bf7c094e5 100755 --- a/test/functional/wallet_watchonly.py +++ b/test/functional/wallet_watchonly.py @@ -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 @@ -50,6 +50,11 @@ class CreateWalletWatchonlyTest(BitcoinTestFramework): 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) |