test: Add test that addmultisigaddress fails for watchonly addresses

This commit is contained in:
MarcoFalke 2019-04-16 13:12:54 -04:00
parent fad81d870a
commit fab6a0a659
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -5,6 +5,9 @@
"""Test multisig RPCs"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_raises_rpc_error,
)
import decimal
@ -26,7 +29,9 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
def run_test(self):
node0, node1, node2 = self.nodes
# 50 BTC each, rest will be 25 BTC each
self.check_addmultisigaddress_errors()
self.log.info('Generating blocks ...')
node0.generate(149)
self.sync_all()
@ -39,6 +44,15 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
self.checkbalances()
def check_addmultisigaddress_errors(self):
self.log.info('Check that addmultisigaddress fails when the private keys are missing')
addresses = [self.nodes[1].getnewaddress(address_type='legacy') for _ in range(2)]
assert_raises_rpc_error(-5, 'no full public key for address', lambda: self.nodes[0].addmultisigaddress(nrequired=1, keys=addresses))
for a in addresses:
# Importing all addresses should not change the result
self.nodes[0].importaddress(a)
assert_raises_rpc_error(-5, 'no full public key for address', lambda: self.nodes[0].addmultisigaddress(nrequired=1, keys=addresses))
def checkbalances(self):
node0, node1, node2 = self.nodes
node0.generate(100)