aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-10-18 20:40:09 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-10-18 20:55:35 +0200
commit1646f9c7603610a55b36ee1f1f057ecabaf3e6de (patch)
tree0324a1c76e3eb18fd218e378e2d0bc2686cc4955 /test
parent51bad9195eb435200626beccbaf6b60774a4a894 (diff)
parent20cdc2b36c40221a0eec942a1fbdf38ca7c4e005 (diff)
downloadbitcoin-1646f9c7603610a55b36ee1f1f057ecabaf3e6de.tar.xz
Merge #11447: 0.15.1: Backports
20cdc2b Fix importmulti bug when importing an already imported key (Pedro Branco) 405e069 Update importprivkey named args documentation (Dusty Williams) c94527a [Docs] Update Windows build instructions for using WSL and Ubuntu 17.04 (fanquake) 27e861a net: Improve and document SOCKS code (Wladimir J. van der Laan) dea3b87 Add new step to clean $PATH var by removing /mnt specific Window's %PATH% paths that cause issues with the make system (Donal OConnor) a43be5b rpc: Prevent `dumpwallet` from overwriting files (Wladimir J. van der Laan) b6c0209 Fix validationinterface build on super old boost/clang (Matt Corallo) 6a62c74 qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) 0fe2a9a when clearing addrman clear mapInfo and mapAddr (Gregory Sanders) 6b4d9f2 wallet: update stored witness in AddToWallet (Suhas Daftuar) 62d18cd doc: Prepare release notes for 0.15.1 (MarcoFalke) 8b61aee Put back inadvertently removed copyright notices (Paul Berg) 75997c3 Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds (Matt Corallo) 8d13b42 Replace save|restoreWindowGeometry with Qt functions (MeshCollider) 6642558 [Qt] Add delay before filtering transactions Fixes 3141 (Lucas Betschart) 19d63e8 Remove custom fee radio group (Andrew Chow) b1a6c94 rpc: make estimatesmartfee argument naming consistent with documentation (Wladimir J. van der Laan) 921542e rpc: update cli for estimatefee argument rename (Wladimir J. van der Laan) 2e31b1d Fix division by zero in time remaining (MeshCollider) 47c02a8 qt: Use IsMine to validate custom change address (Chris Moore) 7310f1f [Qt] Fix display of package name on 'open config file' tooltip (Daniel Edgecumbe) 2cb720a Acquire cs_main lock before cs_wallet during wallet initialization (Russell Yanofsky) b278a43 rpc: Write authcookie atomically (Wladimir J. van der Laan) 50bd3f6 Avoid returning a BIP9Stats object with uninitialized values (practicalswift) 9e8aae3 [wallet] Close DB on error. (Karl-Johan Alm) Pull request description: This mostly backports various commits that fix(ed) bugs and issues. However, it also includes two patches for qt that only fix minor issues, as well as some doc patches. Tree-SHA512: 5165e309faf6b4395fdf2f6662ccc0d58306971f3769e675504f17b2055efe29b2919f22d0dbf78c4c2dc7fd5c9d08a2c53345615e4a1df73914526687c9d571
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/importmulti.py12
-rwxr-xr-xtest/functional/importprunedfunds.py4
-rwxr-xr-xtest/functional/wallet-dump.py5
-rw-r--r--test/util/data/bitcoin-util-test.json18
-rw-r--r--test/util/data/txcreatemultisig5.json26
5 files changed, 62 insertions, 3 deletions
diff --git a/test/functional/importmulti.py b/test/functional/importmulti.py
index 4c519f40d5..6907d64070 100755
--- a/test/functional/importmulti.py
+++ b/test/functional/importmulti.py
@@ -169,6 +169,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())
diff --git a/test/functional/importprunedfunds.py b/test/functional/importprunedfunds.py
index df90e9ec17..996ff96cc3 100755
--- a/test/functional/importprunedfunds.py
+++ b/test/functional/importprunedfunds.py
@@ -79,8 +79,8 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
assert_equal(balance2, Decimal('0.05'))
#Import with private key with no rescan
- self.nodes[1].importprivkey(address3_privkey, "add3", False)
- result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3)
+ self.nodes[1].importprivkey(privkey=address3_privkey, label="add3", rescan=False)
+ self.nodes[1].importprunedfunds(rawtxn3, proof3)
balance3 = self.nodes[1].getbalance("add3", 0, False)
assert_equal(balance3, Decimal('0.025'))
balance3 = self.nodes[1].getbalance("*", 0, True)
diff --git a/test/functional/wallet-dump.py b/test/functional/wallet-dump.py
index 39b7164d6e..bd745ac854 100755
--- a/test/functional/wallet-dump.py
+++ b/test/functional/wallet-dump.py
@@ -7,7 +7,7 @@
import os
from test_framework.test_framework import BitcoinTestFramework
-from test_framework.util import assert_equal
+from test_framework.util import (assert_equal, assert_raises_jsonrpc)
def read_dump(file_name, addrs, hd_master_addr_old):
@@ -105,5 +105,8 @@ class WalletDumpTest(BitcoinTestFramework):
assert_equal(found_addr_chg, 90*2 + 50) # old reserve keys are marked as change now
assert_equal(found_addr_rsv, 90*2)
+ # Overwriting should fail
+ assert_raises_jsonrpc(-8, "already exists", self.nodes[0].dumpwallet, tmpdir + "/node0/wallet.unencrypted.dump")
+
if __name__ == '__main__':
WalletDumpTest().main ()
diff --git a/test/util/data/bitcoin-util-test.json b/test/util/data/bitcoin-util-test.json
index b61a4f7f8f..89b28bba6c 100644
--- a/test/util/data/bitcoin-util-test.json
+++ b/test/util/data/bitcoin-util-test.json
@@ -263,6 +263,13 @@
},
{ "exec": "./bitcoin-tx",
"args":
+ ["-json", "-create", "outpubkey=0:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:WS", "nversion=1"],
+ "return_code": 1,
+ "error_txt": "error: Uncompressed pubkeys are not useable for SegWit outputs",
+ "description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outdata=4:badhexdata"],
@@ -388,5 +395,16 @@
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS", "nversion=1"],
"output_cmp": "txcreatemultisig4.json",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH (output in json)"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:S"],
+ "output_cmp": "txcreatemultisig5.json",
+ "description": "Uncompressed pubkeys should work just fine for non-witness outputs"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:047d1368ba7ae01c94bc32293efd70bd7e3be7aa7912d07d0b1c659c1008d179b8642f5fb90f47580feb29f045e216ff5a4716d3a0fed36da414d332046303c44a:WS"],
+ "return_code": 1,
+ "error_txt": "error: Uncompressed pubkeys are not useable for SegWit outputs",
+ "description": "Ensure adding witness outputs with uncompressed pubkeys fails"
}
]
diff --git a/test/util/data/txcreatemultisig5.json b/test/util/data/txcreatemultisig5.json
new file mode 100644
index 0000000000..20e9bb077b
--- /dev/null
+++ b/test/util/data/txcreatemultisig5.json
@@ -0,0 +1,26 @@
+{
+ "txid": "813cf75e1f08debd242ef7c8192b7d478fb651355209369499a0de779ba7eb2f",
+ "hash": "813cf75e1f08debd242ef7c8192b7d478fb651355209369499a0de779ba7eb2f",
+ "version": 2,
+ "size": 42,
+ "vsize": 42,
+ "locktime": 0,
+ "vin": [
+ ],
+ "vout": [
+ {
+ "value": 1.00000000,
+ "n": 0,
+ "scriptPubKey": {
+ "asm": "OP_HASH160 a4051c02398868af83f28f083208fae99a769263 OP_EQUAL",
+ "hex": "a914a4051c02398868af83f28f083208fae99a76926387",
+ "reqSigs": 1,
+ "type": "scripthash",
+ "addresses": [
+ "3GeGs1eHUxPz5YyuFe9WPpXid2UsUb5Jos"
+ ]
+ }
+ }
+ ],
+ "hex": "02000000000100e1f5050000000017a914a4051c02398868af83f28f083208fae99a7692638700000000"
+}