Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_keypool.py
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# refill keypool with three new addresses | # refill keypool with three new addresses | ||||
nodes[0].walletpassphrase('test', 1) | nodes[0].walletpassphrase('test', 1) | ||||
nodes[0].keypoolrefill(3) | nodes[0].keypoolrefill(3) | ||||
# test walletpassphrase timeout | # test walletpassphrase timeout | ||||
time.sleep(1.1) | time.sleep(1.1) | ||||
assert_equal(nodes[0].getwalletinfo()["unlocked_until"], 0) | assert_equal(nodes[0].getwalletinfo()["unlocked_until"], 0) | ||||
# drain them by mining | # drain the keypool | ||||
nodes[0].generate(1) | for _ in range(3): | ||||
nodes[0].generate(1) | nodes[0].getnewaddress() | ||||
nodes[0].generate(1) | assert_raises_rpc_error(-12, "Keypool ran out", nodes[0].getnewaddress) | ||||
assert_raises_rpc_error(-12, "Keypool ran out", nodes[0].generate, 1) | |||||
nodes[0].walletpassphrase('test', 100) | nodes[0].walletpassphrase('test', 100) | ||||
nodes[0].keypoolrefill(100) | nodes[0].keypoolrefill(100) | ||||
wi = nodes[0].getwalletinfo() | wi = nodes[0].getwalletinfo() | ||||
assert_equal(wi['keypoolsize_hd_internal'], 100) | assert_equal(wi['keypoolsize_hd_internal'], 100) | ||||
assert_equal(wi['keypoolsize'], 100) | assert_equal(wi['keypoolsize'], 100) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
KeyPoolTest().main() | KeyPoolTest().main() |