Skip to content

Commit 8dee97f

Browse files
jonasschnelliMarcoFalke
authored andcommitted
[QA] add fundrawtransaction test on a locked wallet with empty keypool
Github-Pull: #9295 Rebased-From: 1a6eacb
1 parent 82e29e8 commit 8dee97f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

qa/rpc-tests/fundrawtransaction.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,23 @@ def run_test(self):
457457
self.is_network_split=False
458458
self.sync_all()
459459

460+
# drain the keypool
461+
self.nodes[1].getnewaddress()
462+
inputs = []
463+
outputs = {self.nodes[0].getnewaddress():1.1}
464+
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
465+
# fund a transaction that requires a new key for the change output
466+
# creating the key must be impossible because the wallet is locked
467+
try:
468+
fundedTx = self.nodes[1].fundrawtransaction(rawTx)
469+
raise AssertionError("Wallet unlocked without passphrase")
470+
except JSONRPCException as e:
471+
assert('Keypool ran out' in e.error['message'])
472+
473+
#refill the keypool
474+
self.nodes[1].walletpassphrase("test", 100)
475+
self.nodes[1].walletlock()
476+
460477
try:
461478
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2)
462479
raise AssertionError("Wallet unlocked without passphrase")

0 commit comments

Comments
 (0)