aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2016-12-07 15:20:40 +0100
committerMarcoFalke <falke.marco@gmail.com>2016-12-14 12:58:11 +0100
commit0cc07f82f0d4043e93d8cea49356cd2bc5ffcb27 (patch)
treeaa5f83fc1c282962a4ff7f5f2e3f174c3c7ca2c1
parent782328660e6dc44c026d13fef4d069ad8cad4d42 (diff)
downloadbitcoin-0cc07f82f0d4043e93d8cea49356cd2bc5ffcb27.tar.xz
[QA] add fundrawtransaction test on a locked wallet with empty keypool
Github-Pull: #9295 Rebased-From: 1a6eacbf3b7e3d5941fec1154079bbc4678ce861
-rwxr-xr-xqa/rpc-tests/fundrawtransaction.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/qa/rpc-tests/fundrawtransaction.py b/qa/rpc-tests/fundrawtransaction.py
index 8c45578fcf..0dcca4cb57 100755
--- a/qa/rpc-tests/fundrawtransaction.py
+++ b/qa/rpc-tests/fundrawtransaction.py
@@ -484,6 +484,23 @@ class RawTransactionsTest(BitcoinTestFramework):
self.is_network_split=False
self.sync_all()
+ # drain the keypool
+ self.nodes[1].getnewaddress()
+ inputs = []
+ outputs = {self.nodes[0].getnewaddress():1.1}
+ rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
+ # fund a transaction that requires a new key for the change output
+ # creating the key must be impossible because the wallet is locked
+ try:
+ fundedTx = self.nodes[1].fundrawtransaction(rawTx)
+ raise AssertionError("Wallet unlocked without passphrase")
+ except JSONRPCException as e:
+ assert('Keypool ran out' in e.error['message'])
+
+ #refill the keypool
+ self.nodes[1].walletpassphrase("test", 100)
+ self.nodes[1].walletlock()
+
try:
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2)
raise AssertionError("Wallet unlocked without passphrase")