mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
test: disallow sendtoaddress/sendmany when private keys disabled
This commit is contained in:
@ -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
|
||||
@ -49,6 +49,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)
|
||||
|
Reference in New Issue
Block a user