aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_createmultisig.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-04-16 13:12:54 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-04-17 07:43:34 -0400
commitfab6a0a659bb856e4598af3e0679fc37d5239478 (patch)
tree45b43f3fc16752994c05879eff268a136e467e5a /test/functional/rpc_createmultisig.py
parentfad81d870aa6dd25d4fab5faad4c956ba364734a (diff)
test: Add test that addmultisigaddress fails for watchonly addresses
Diffstat (limited to 'test/functional/rpc_createmultisig.py')
-rwxr-xr-xtest/functional/rpc_createmultisig.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py
index 0a3e3d8f75..7abcd71bb8 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)