Permalink
Browse files

[QA] add fundrawtransaction test on a locked wallet with empty keypool

Github-Pull: #9295
Rebased-From: 1a6eacb
  • Loading branch information...
1 parent 82e29e8 commit 8dee97f98253c7d7a5219f4ab0d0e6e9bec0dcef @jonasschnelli jonasschnelli committed with MarcoFalke Dec 7, 2016
Showing with 17 additions and 0 deletions.
  1. +17 −0 qa/rpc-tests/fundrawtransaction.py
@@ -457,6 +457,23 @@ def run_test(self):
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")

0 comments on commit 8dee97f

Please sign in to comment.