tui: F6 opens the wallet screen instead of exiting when no wallet is configured #161
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_da08817e-onionwire-tui-f6-exits-the-app-when-no-w"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this fixes
F6on an install with no wallet RPC configured and no profilexmr_addrused toterminate the process:
App::open_walletpropagated thatErrwith?; it ran out ofApp::runand outof
boot()insrc/main.rs, which printed it and exited 1. An unconfigured walletis a normal state on that screen, not a fatal one —
App::open_wallets_settings(
F9) already degrades the same call withunwrap_or_default().What changed (
src/tui.rs,App::open_walletonly)The address call now degrades to an empty
receive_addrinstead of returning anerror, so
F6always opensScreen::Wallet.It leaves a status note naming the way forward:
Delegating to the existing
wallet::NOT_CONNECTED_MSGwhen the wallet isconfigured but the call still failed, so a broken endpoint is not reported as an
absent one.
balanceandtransfersare untouched.Node::wallet_receive_addressandNode::invoice_addressare untouched.Which assumption this makes about F7
On the base commit (
a1f5c87)KeyCode::F(7)has no binding at all — the onlything that mentions F7 is
wallet::NOT_CONFIGURED_MSG, copy that is assertedverbatim elsewhere and that this card must not touch. So the note does not tell
the user to press F7: it names the create/import keys that exist on this very screen
today (
c/i, both already in the screen's own help line) plus the env var, whichis true on this base and stays true after the F7 setup screen lands. If you would
rather the note name F7 once that screen exists, it is a one-line change to
App::WALLET_SETUP_NOTE.Tests (
mod wallet_store_tests, realApp::drawat 80x24)f6_on_a_bare_install_opens_the_wallet_screen_instead_of_exiting—handle_key(F6)returns
Ok, the screen isScreen::Wallet { .. },receive_addris empty andstatus_noteisSome(containsno wallet configured). Red before the fix:the call returned
Err("no receive address — set profile xmr or ONIONWIRE_WALLET_RPC").f6_on_a_bare_install_never_draws_the_error_and_states_the_way_forward— the framedrawn through
App::drawnever contains the node's error text, and afterEscthemain view's status line really renders the note.
f6_on_an_install_with_a_wallet_still_fills_the_receive_address— control: with aprofile
xmr_addr(the documented mainnet addresstests/wallet.rsuses),receive_addris that address andstatus_notestaysNone. This passed beforethe change and still does.
wallet_offset_tests::only_seen_leaves_the_offset_notice_for_the_walletassertedthe propagation itself (
expect_erron the missing wallet). It now asserts thescreen the full word reaches (
Screen::Wallet { .. }); the prefix half is unchanged.What
F6now shows on a bare install, one line: the wallet screen (titlewallet,its own
s/x/p/c/i/rhelp line) — it opens instead of exiting, with an empty addressand the note above on the main view's status line.
Evidence
Found while doing this: the wallet screen's body is clipped (not fixed here)
Dumping the real frame through
App::drawat 80x24 shows theScreen::Walletbody(
address/balance/recent transfers) is not rendered at all — with areceive address or without:
Cause:
draw_walletrenders thatParagraphintocols[2]ofLayout::vertical([Length(2), Min(4), Length(2), Length(3), Length(1)])— a2-row slot whose borders consume both rows. The
Min(4)slot (cols[1]) is theone that gets the height and is left empty at
src/tui.rs:5327-5381. Pre-existingon
main, independent of this fix, and out of the allowed scope of this card(
App::open_wallet+ test fns only), so it is reported rather than patched here.It is also why the visible consequence of this fix on the F6 screen itself is "the
screen opens, the address field is empty" and not a printed
no address: the notelands in
status_note, which the main view's status line renders.Files:
src/tui.rsonly (+148/-8).