wallet: show the chain daemon's sync height/target on the child status #129
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_bd2e2cd0-onionwire-wallet-show-daemon-sync-height"
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
The Android in-process Cuprate wallet showed only a phase word —
connecting · in-process mainnet pruned · node starting, withwallet connect: Connection refused (os error 111)— so there was no way to see how far the chain had got. This adds the daemon's height and target to the wallet-child status, on the TUI one-liner and through UniFFI.Line shape (prefix and
node_statewords unchanged):0/0— or nosyncsegment — means unknown: child off/exited, probe failed, or the daemon reported no target. No percentage is derived (h/0is honest), and this is never a wallet-scan height.How
src/wallet_child.rs:WalletChildStatusgainsheight/target_height;line()appends· sync h/twhen either is non-zero, error text still last. NewChildConfig::daemon_probe_addr()returns the loopback daemon address only forLocal/InProcessCuprate— a remote (incl. onion) daemon is the wallet child's to dial, never probed by a status refresh.src/wallet.rs:Wallet::chain_info()is the singleget_infoparse;chain_ready()is nowchain_info().ready(), so the spend gate and the status line ask once instead of twice.ChainInfo::ready()keeps the exact predicate (synchronizedexplicitly true, height > 0, height >= target unless target is 0).src/node.rs:child_height/child_targetatomics (same shape aschild_synced), read on the draw path, written only bywallet_child_refresh(). Refresh uses the wallet RPC when it answers; when it does not, and the source is local/in-process, it asks the daemon directly (3 s budget, local TCP). Start/stop/shutdown reset the probe, and an off/exited child reports0/0regardless of what the last probe left behind.crates/onionwire-sdk/src/lib.rs: the UniFFI record carries the same twou64fields (afternode_state, beforelast_error), copied inchild_status.src/tui.rs: no change needed — the wallet screen already renderswallet_child_line()and the in-process testnet caveat after it, not instead of it. No second height widget.docs/WALLET.md: one paragraph documenting thesync h/tsegment and what0/0means.Tests (all run)
src/wallet_child.rs: line with0/0is unchanged and contains nosync;1160/3090939;4549/0with no%; error stays after the segment; only loopback sources get a probe address (Local + InProcessCuprate yes; None + onion + clearnet-remote no).src/node.rs: a mock wallet RPC that answersget_address/get_balance/ a syncingget_infofills4549/0and the line showssync 4549/0; the 111 case — wallet RPC refused,Localsource, mock daemon on127.0.0.1:18081— fills1160/3090939while the state correctly staysconnecting.the_daemons_height_and_target_reach_the_sdk_record(1160/3090939 round trip,statestill verbatim) andan_unprobed_child_reports_an_unknown_chain_progress(0/0).Evidence:
rustfmt --edition 2024 --checkon the four touched Rust files reports the same hunk count asorigin/main, so no inherited churn was added (src/node.rsand the SDK already carried 2 and 1 pre-existing hunks).Notes / deviations
127.0.0.1:18081; if that port is already held (a realmonerodon the dev box) the test prints a skip note and returns rather than replacing someone else's daemon. On CI and on this machine it bound and served the answer.android/CUPRATE_DAEMON.mdstill says "No sync height.WalletChildStatushas no height field." That file isandroid/**, forbidden for this card (apk-dev owns it) — the UniFFI fields are in place, so a one-line doc fix there is all that is left. Flagged rather than edited out of scope.