Skip to content

wallet: qbit-qt unlock does not run the keypool top-up that walletpassphrase now runs (#299 follow-up) #355

Open

Description

@kiwidream

Summary

With #299, walletpassphrase calls the new TopUpKeyPoolAfterUnlock(). That function tops up the non-P2MR active keypools inline, and schedules a background refill of any P2MR receive or change pool that is not full. The qbit-qt unlock does not do this. interfaces::Wallet::unlock only schedules a pending create-time top-up, so GUI and RPC unlocks leave the wallet in different states.

Observed

At #299's head ae4045b2e7, which is not merged yet. Found while reviewing the #299 work, from the code; not reproduced in the GUI.

  • walletpassphrase (src/wallet/rpc/encrypt.cpp:100) calls TopUpKeyPoolAfterUnlock(context, wallet) (src/wallet/wallet.cpp:683).
  • interfaces::Wallet::unlock (src/wallet/interfaces.cpp:163-170) calls Unlock(pass, false), then only MaybeSchedulePendingInitialKeyPoolTopUp.
  • After a GUI unlock, a partly used P2MR pool that is still above its low watermark is not refilled until a later address request crosses the watermark. Hardened non-P2MR descriptors, which can only be topped up while the wallet is unlocked, are not topped up at all.

Impact

Low. A GUI user can run out of hardened non-P2MR keys while the wallet is locked sooner than an RPC user would. Payments to addresses beyond the current lookahead are also detected later. No funds are lost.

Suggested fix

Call TopUpKeyPoolAfterUnlock() from interfaces::Wallet::unlock once Unlock() has returned, outside cs_wallet, so both unlock paths share it. Confirm it does not block the GUI thread: the non-P2MR top-up is fast and the P2MR refill is scheduled. Add a test next to #299's WalletPassphrase* cases.

Related: #299, #304, #284.

Activity

  1. added
    bug
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions