aboutsummaryrefslogtreecommitdiff
path: root/test/functional/importmulti.py
diff options
context:
space:
mode:
authorPedro Branco <branco@uphold.com>2017-10-11 11:12:59 +0100
committerPedro Branco <branco@uphold.com>2017-10-11 17:20:42 +0100
commita44a215177ab55b4a3b36a7980c313e908e2dd18 (patch)
treea40bc2574db7c70cb36e6cc9d9cb1dfd66bfb686 /test/functional/importmulti.py
parent364da2c52942ebfe92d1d1495a309a8a9dd18ef3 (diff)
downloadbitcoin-a44a215177ab55b4a3b36a7980c313e908e2dd18.tar.xz
Fix importmulti bug when importing an already imported key
Diffstat (limited to 'test/functional/importmulti.py')
-rwxr-xr-xtest/functional/importmulti.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/importmulti.py b/test/functional/importmulti.py
index c1a42870ec..a691595f15 100755
--- a/test/functional/importmulti.py
+++ b/test/functional/importmulti.py
@@ -160,6 +160,18 @@ class ImportMultiTest (BitcoinTestFramework):
assert_equal(address_assert['ismine'], True)
assert_equal(address_assert['timestamp'], timestamp)
+ self.log.info("Should not import an address with private key if is already imported")
+ result = self.nodes[1].importmulti([{
+ "scriptPubKey": {
+ "address": address['address']
+ },
+ "timestamp": "now",
+ "keys": [ self.nodes[0].dumpprivkey(address['address']) ]
+ }])
+ assert_equal(result[0]['success'], False)
+ assert_equal(result[0]['error']['code'], -4)
+ assert_equal(result[0]['error']['message'], 'The wallet already contains the private key for this address or script')
+
# Address + Private key + watchonly
self.log.info("Should not import an address with private key and with watchonly")
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())