diff options
| author | bitflash <dev@bitflash.network> | 2026-08-18 14:23:38 -0300 |
|---|---|---|
| committer | bitflash <dev@bitflash.network> | 2026-08-18 14:23:38 -0300 |
| commit | e58c4022e0ddd137b93cdb3464753bef5df1d456 (patch) | |
| tree | 8adc9ec855d19e5a7308eb2a1b2be8139db47188 /src/gui.cpp | |
| parent | beb5c1435a0d85b7b24d4d371933758ebed90907 (diff) | |
wallet: encrypt atomically under the SQLite backend
EncryptWallet() had only a Berkeley DB path: it rebuilt a wallet.dat temp
file and swapped it in. Under -walletbackend=sqlite that was wrong -- it
would leave the live wallet.sqlite unencrypted and write a divergent
wallet.dat instead. Add a SQLite persistence branch that rebuilds a fresh
wallet.sqlite in one transaction (public records copied from the live
store, encrypted key material serialized byte-for-byte the way the BDB
path writes it), checkpoints it, and swaps it in with a .before-encrypt
backup, mirroring the BDB rename dance. A fresh file rather than an
in-place rewrite keeps the change atomic and leaves no plaintext key in a
freed page.
CmdEncryptWallet skips PurgeDbEnvironmentLogs under SQLite (no Berkeley DB
environment behind the wallet) and reports the backend it used.
New wallet-sqlite-encrypt self-test drives the real command path in child
processes: export a wallet to SQLite, encrypt it through
-walletbackend=sqlite, and prove it comes out encrypted, unlockable with
the right passphrase, refusing the wrong one, with its recovery phrase
intact and the original wallet.dat left untouched.
Diffstat (limited to 'src/gui.cpp')
0 files changed, 0 insertions, 0 deletions