You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wallet: SignTransaction releases its active-signing guard before freeing decrypted providers #287
In CWallet::SignTransaction, the decrypted signing providers outlive the guard that Lock() waits for. The guard is released first, so Lock() can return while copies of decrypted keys are still being freed. CWallet::FillPSBT declares the same guard in the safe order.
Current behaviour
In wallet.cpp#L2576-L2584, providers is declared before the active_signing_snapshot guard.
Locals are destroyed in reverse order, so RemoveActiveSigningProviderSnapshot() runs before the providers are destroyed. The providers hold every decrypted ECDSA and PQC key of the descriptor.
Lock() (#L4662-L4681) can therefore clear the master key and return while those secure buffers still exist, for as long as their destruction takes. With large keypools that is milliseconds.
FillPSBT (#L2806-L2826) declares the guard before the providers.
I found this by reading the code; I did not reproduce it.
Expected behaviour
Every decrypted key copy owned by a signing operation should be destroyed before its guard is released.
Suggested fix
Declare the guard before providers, or call providers.clear() before the function returns.
Version
1.x.x at e374ba24cf; v1.0.0 has the same structure.
Fixed on 1.x.x by #299 (merged as dd86425), which declares SignTransaction's active-signing guard before the decrypted providers, so Lock() returns only after the decrypted key copies are freed. main gets the fix when 1.x.x is integrated.
Activity
wallet: deferred P2MR keypool refill at startup and unlock; Lock() wa…
kiwidream commentedon Nov 5, 2026
Fixed on
1.x.xby #299 (merged as dd86425), which declares SignTransaction's active-signing guard before the decrypted providers, so Lock() returns only after the decrypted key copies are freed.maingets the fix when1.x.xis integrated.wallet: deferred P2MR keypool refill at startup and unlock; Lock() wa…