TUI: node control, chain-source picker, honest wallet sync readiness
Add the TUI control plane for the wallet child and chain source, stacked on the wallet-child-lifecycle card: - Chain-source picker (s): receive-only / local monerod / remote daemon with daemon-address entry + trust-shift warning for clearnet hosts - Node control (n): start/stop the app-owned monero-wallet-rpc child, with fail-closed onion+SOCKS guard in the status line - Wallet screen refreshes after picker/child changes, shows sync progress from the daemon and the chain-source/free-space/storage status line - Honest spend guard: wallet view reflects real WalletStatus + Readiness so balance/transfer rendering only claims authority when the daemon is reachable, never while the child is silent - Help overlay + footer hints updated for the new 's'/'n' keys - Tests: chain-source round-trip through sealed record, saved-source starts the child, parse_source handles the 'none' kind
This commit is contained in:
parent
ee5b25488b
commit
cfdfe38536
6 changed files with 1364 additions and 82 deletions
|
|
@ -6,9 +6,9 @@ use onionwire::outbox::{OutboxEntry, OutboxStatus};
|
|||
use onionwire::qr;
|
||||
use onionwire::tui::{
|
||||
OutboxSummary, alert_line, ascii_chrome, chat_with_delivery, delivery_tag, draw_chat,
|
||||
draw_share, draw_text_overlay, empty_friend_chat_text, help_overlay_text, main_footer_hints,
|
||||
main_header_line, paste_screen_text, retry_in_text, roster_col_width, short_send_reason,
|
||||
status_footer, wrap_invite,
|
||||
draw_share, draw_text_overlay, empty_friend_chat_text, help_overlay_text, is_onion_host,
|
||||
main_footer_hints, main_header_line, parse_daemon_addr, paste_screen_text, retry_in_text,
|
||||
roster_col_width, short_send_reason, status_footer, wrap_invite,
|
||||
};
|
||||
use ratatui::Frame;
|
||||
use ratatui::Terminal;
|
||||
|
|
@ -796,3 +796,51 @@ async fn renders_a_queued_row_from_a_real_outbox_send() {
|
|||
assert!(delivered[0].contains('✓'), "{:?}", delivered[0]);
|
||||
assert_eq!(summary.note(), None);
|
||||
}
|
||||
|
||||
/// The chain-source picker's address field: whatever the user typed either
|
||||
/// parses into exactly `host:port`, or it is refused with a reason. `.onion`,
|
||||
/// loopback and clearnet are all accepted — clearnet only because the user
|
||||
/// typed it here — and there is no default port.
|
||||
#[test]
|
||||
fn daemon_addresses_parse_or_are_refused() {
|
||||
assert_eq!(
|
||||
parse_daemon_addr(" 127.0.0.1:18081 ").unwrap(),
|
||||
("127.0.0.1".to_string(), 18081)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_daemon_addr("abc234defghijklmnop.onion:18089").unwrap(),
|
||||
("abc234defghijklmnop.onion".to_string(), 18089)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_daemon_addr("node.example.com:18089").unwrap(),
|
||||
("node.example.com".to_string(), 18089)
|
||||
);
|
||||
assert_eq!(parse_daemon_addr("[::1]:18081").unwrap().1, 18081);
|
||||
|
||||
for bad in [
|
||||
"",
|
||||
" ",
|
||||
"127.0.0.1",
|
||||
"host:",
|
||||
":18081",
|
||||
"host:0",
|
||||
"host:65536",
|
||||
"host:abc",
|
||||
"host:-1",
|
||||
"http://host:18081",
|
||||
"host/path:18081",
|
||||
"ho st:18081",
|
||||
] {
|
||||
let err = parse_daemon_addr(bad).expect_err(&format!("{bad:?} must be refused"));
|
||||
assert!(!err.is_empty(), "{bad:?} refused without a reason");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn onion_hosts_are_recognised_before_any_spawn() {
|
||||
assert!(is_onion_host("abc234.onion"));
|
||||
assert!(is_onion_host("ABC234.ONION "));
|
||||
assert!(!is_onion_host("127.0.0.1"));
|
||||
assert!(!is_onion_host("node.example.com"));
|
||||
assert!(!is_onion_host("notonion"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue