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/makefile.mingw | |
| 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/makefile.mingw')
| -rw-r--r-- | src/makefile.mingw | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/makefile.mingw b/src/makefile.mingw index 14e6b32..1cb47fb 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw | |||
| @@ -112,6 +112,7 @@ tests: test_bip32.exe bitflash.exe | |||
| 112 | ./bitflash.exe -selftest=wallet-sqlite-migration | 112 | ./bitflash.exe -selftest=wallet-sqlite-migration |
| 113 | ./bitflash.exe -selftest=wallet-crypto | 113 | ./bitflash.exe -selftest=wallet-crypto |
| 114 | ./bitflash.exe -selftest=wallet-encrypt | 114 | ./bitflash.exe -selftest=wallet-encrypt |
| 115 | ./bitflash.exe -selftest=wallet-sqlite-encrypt | ||
| 115 | ./bitflash.exe -selftest=net-message | 116 | ./bitflash.exe -selftest=net-message |
| 116 | ./bitflash.exe -selftest=consensus-limits | 117 | ./bitflash.exe -selftest=consensus-limits |
| 117 | ./bitflash.exe -selftest=pool-stratum | 118 | ./bitflash.exe -selftest=pool-stratum |