diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-04-16 13:12:54 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-06-21 08:17:20 -0400 |
commit | 23ba460c1abe1e089c64e87abe919e87a320b32d (patch) | |
tree | 3a047435bd171f428597c58ef8940da991686cc7 | |
parent | 13b3bb564485b239822fb8bbdab7ce528f0f0d6f (diff) |
test: Add test that addmultisigaddress fails for watchonly addresses
Github-Pull: #15831
Rebased-From: fab6a0a659bb856e4598af3e0679fc37d5239478
-rwxr-xr-x | test/functional/rpc_createmultisig.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py index 553be2d2bd..6411b0e285 100755 --- a/test/functional/rpc_createmultisig.py +++ b/test/functional/rpc_createmultisig.py @@ -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) |