Repository navigation
friglet-tray: edit config.toml when the daemon is down (#78) - #83
Open
setavenger wants to merge 5 commits into
Open
setavenger wants to merge 5 commits into
setavenger wants to merge 5 commits into
Conversation
Outside first-run setup the Settings form only loaded and saved through the daemon's control socket. A saved config that makes the daemon exit at startup (start_at_tip while the oracle is down, an unresolvable P2P host, ...) therefore locked the form that could fix it. When the daemon has crashed or is not running, the form now loads the config file (get_config_file) and Save writes it through the tray (save_config_file: setup's validation, scan key optional so the key file is kept), then starts the daemon. The form stays in this mode through restart attempts until the daemon answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A `descriptor` in the config file supplies the keys when nothing new
is entered (the save drops the key, and the daemon may have exited
before copying its scan key), so a stale key file can no longer be
paired with the descriptor's spend key; the network check applies.
- Scan and spend keys are checked as secp256k1 keys before a save can
replace a working key file.
- Save starts the daemon like Start daemon: clears a user stop and
resets the restart backoff.
- File mode is entered only for the tray's own crashed daemon
("restarting"); an external daemon may use another config file.
- A config file that cannot be read is shown as the reason and retried
each poll, so a hand fix is picked up without restarting the tray.
- "New wallet" kept as loaded adopts a start_height a restart attempt
recorded meanwhile, instead of moving the birthday to a later tip.
- Spawn-failure messages survive the switch into file mode; a daemon
save stops waiting once the restarted daemon crashed; a late daemon
config load no longer overwrites the file contents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The "keep a recorded birthday" check moves into save_config_file, under the lifecycle lock, so it cannot race a restart attempt that records start_height; the form only says whether "new wallet" is unchanged for the same wallet and network. After a save whose start failed, the baseline is what was written, not a stale load. - An empty or unparseable descriptor in the file no longer blocks saves (the save drops it); a file descriptor whose spend key differs from the one shown is refused instead of silently swapped in. - A tray-owned child that does not answer is stopped before the file is written, so it cannot record a birthday into the new file. - get_config_file is async and names env-only configs when there is no file; docs match the "restarting"-only entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Triage of two Fixed
Not changed
|
- The "unresolved birthday at load" flag is always a bool: with start_at_tip skipped when false, the old expression could be undefined, and Tauri rejected every such "New wallet" save. - save_config_file decides whether to keep a recorded birthday itself: only for the same wallet and network as the file on disk, and only when the form loaded an unresolved "new wallet" birthday. A re-pasted descriptor of the same wallet no longer drops it, and an explicit height in a hand-edited file is no longer adopted over "New wallet". - After a save whose start failed, the form reloads the file, so a birthday the daemon recorded before exiting is shown and kept. - A missing key file fails the save before our child is stopped; the exited child is reaped (and logged) first; the child teardown is one helper shared with attach_and_record. - The network-mismatch test asserts the network error again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Third Fixed
Not changed
|
A Reload that cannot read config.toml (e.g. a hand edit left it broken) kept the old copy and an enabled form, so Save wrote that copy over the file. Drop it: the form is disabled with the error and loads by itself once the file can be read again. Drop the second key-file check in write_config_file; save_config_file checks it before stopping the child. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Review 4 ( Fixed in
Not changed:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #78 on the tray side: the issue's "Expected", and fix 2 in the follow-up comment.
Problem. Outside first-run setup, the Settings form only loads and saves through the daemon's control socket. If a saved config makes the daemon exit at startup (
start_at_tipwhile the oracle is down, an unresolvable P2P host, …), the form that could fix it stays disabled.Change. When the tray's own daemon has crashed (Status: "crashed — restarting"), the form switches to file mode:
config.tomlthroughget_config_file. Adescriptorkey fills in the spend key andbh=birthday, as the daemon applies them. A file that can't be read is shown as the reason and retried on every poll.save_config_file. The tray checks the settings itself, including secp256k1 checks on the keys. The scan key is optional: adescriptorin the file supplies it, otherwise the key file is kept. Under the lifecycle lock it refuses if a daemon answers, stops our own child if it isn't answering, keeps a birthday a restart attempt recorded meanwhile, and writes the file. It then starts the daemon the way Start daemon does: it clears a user stop and resets the backoff.Verified
cargo test -p friglet-tray: 70 unit and 7 e2e tests pass. Clippy-D warningsand fmt are clean.start_at_tip = truewith an unreachable oracle reproduced the crash loop. The form came up editable and filled from the file. Choosing a block height and saving wrotestart_height, droppedstart_at_tipand respawned the daemon.p2p_node_addrmade the daemon exit at startup. Fixing it in the form gave "Saved — daemon started." and the form went back to loading from the daemon.config.tomlshowed the parse error with the form disabled. After the file was fixed by hand, the form loaded by itself.config.tomlby hand while the form was loaded, then pressing Reload, disabled the form and showed the parse error. Fixing the file loaded the form again by itself./code-reviewpasses; triage is in the PR comments.Not in this PR
start_at_tip, the daemon still exits when the oracle can't answerGetInfo. It needsstart_heightbefore it brings up the scanner, Electrum and the control socket.transport erroreven whenstart_heightis fixed.