diff options
| author | Bitflash <btf01@proton.me> | 2026-08-04 10:13:41 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-04 10:13:41 -0300 |
| commit | 530f91910a4eceb6705d1212fa0e3ebe8418c6a3 (patch) | |
| tree | e8834760736e765178413c5925f56293888fbf15 /src/db.h | |
| parent | 1db5f372c36eb701602a70a358de2344726ed734 (diff) | |
gui: say why the wallet would not open, where the user can see it (#136)
Every fatal startup path wrote to stderr and to printf, and on Windows
neither reaches anybody. printf is remapped to OutputDebugStringF, so it
lands in debug.log inside the data directory. A -mwindows binary started
by double-clicking has no stderr at all, and AttachTerminal() cannot
help: it attaches to a parent console, which a double-clicked exe does
not have.
So Bitflash exited silently. Someone whose wallet.dat needs a newer
build -- exactly what the wallet format guard was added to tell them --
double-clicked and watched nothing happen. The guard was correct and
mute, which is the failure it was written to prevent.
Fatal startup errors now go through one reporter: debug.log as before,
stderr as before, and a message box when there is a person in front of
the screen. Applied to the three that mean "your data will not open":
the block index failing to load, the block index throwing, and
wallet.dat failing or throwing.
The box is deliberately not shown for a headless node. Those run under
scheduled tasks and services, where a modal dialog waits forever for a
click nobody is there to make -- a hung process instead of an exit code.
Headless keeps stderr and the log.
LoadWallet() now also reports why it refused, in a sentence, instead of
only logging it. The unsupported-format case is the one that has to be
understood by whoever reads it, and "LoadWallet failed" is not that.
Verified by breaking a throwaway wallet on purpose and starting both
ways. Headless: exit code 1, no dialog, no process left behind. Windowed
with no console: a box naming the file, the Berkeley DB error, the usual
cause, and where to look for more.
Diffstat (limited to 'src/db.h')
| -rw-r--r-- | src/db.h | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -54,6 +54,9 @@ extern void DBFlush(bool fShutdown); | |||
| 54 | // this: the logs hold the plaintext records the old wallet wrote. | 54 | // this: the logs hold the plaintext records the old wallet wrote. |
| 55 | extern void PurgeDbEnvironmentLogs(); | 55 | extern void PurgeDbEnvironmentLogs(); |
| 56 | 56 | ||
| 57 | // Set by LoadWallet() when it refuses for a reason worth telling the user. | ||
| 58 | extern string strWalletLoadError; | ||
| 59 | |||
| 57 | 60 | ||
| 58 | 61 | ||
| 59 | 62 | ||