use WalletContext scheduler for walletpassphrase callback

This commit is contained in:
Matthew Zipkin
2025-07-02 19:27:40 -04:00
parent a92e8b10a5
commit 8a1765795f
2 changed files with 14 additions and 11 deletions

View File

@@ -4,7 +4,6 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet keypool and interaction with wallet encryption/locking."""
import time
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework
@@ -127,8 +126,10 @@ class KeyPoolTest(BitcoinTestFramework):
nodes[0].keypoolrefill(3)
# test walletpassphrase timeout
time.sleep(1.1)
assert_equal(nodes[0].getwalletinfo()["unlocked_until"], 0)
# CScheduler relies on condition_variable::wait_until() which does not
# guarantee accurate timing. We'll wait up to 5 seconds to execute a 1
# second scheduled event.
nodes[0].wait_until(lambda: nodes[0].getwalletinfo()["unlocked_until"] == 0, timeout=5)
# drain the keypool
for _ in range(3):