sdk: expose a live wallet-child probe over UniFFI (wallet_child_refresh) #132
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_0a355a62"
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?
Why
The Android wallet screen polls
Wire::wallet_status()every 2s, and that call is the cheap cached read (Node::wallet_child_status, "no dial").state/height/target_heightare written only byNode::wallet_child_refresh, which over UniFFI was reachable from exactly one place: insidestart_wallet_child. So thesync h/tsegment only moved when a chain-mode tap happened to re-start the child.What
One additive export, in the same
impl Wireblock as the other wallet-child calls:child_statusmapper, so the record is the same shape aswallet_status()— no new UniFFI record, no new field, no new crate.Node::wallet_child_refresh) as the only probe path.src/is untouched, andwallet_status()keeps its documented cheap, non-dialing semantics (Kotlin uses it for first paint).get_infowhen the wallet RPC does not answer), that it never spawns or starts a child, that it is safe from a refresh loop but not free (poll on the order of seconds), and the honest limit: with no live child the core short-circuits and returns the cachedoff/exitedsnapshot, so it cannot inventready.docs/WALLET.mdenumerates the SDK wallet-child surface, so its Android bullet now names the probe and labelswallet_status()as the cached read.Tests
crates/onionwire-sdkhas no offlineNode:open_wireis the only constructor ofWireand it bootstraps Arti and publishes an onion service. The card's literal case ("a node with no child") therefore cannot be assembled in the SDK's own test crate. What is covered here is what this crate owns:an_unprobed_child_is_off_whichever_read_reports_it— the unprobed snapshot maps to the sameoffrecord for both exported reads. The expected record is an exhaustive struct literal, so adding a field toWalletChildStatusstops the test compiling (the additive-only requirement, enforced by the compiler).wallet_child_refresh_on_a_stopped_handle_is_stopped_error— the new export goes through the samenode()accessor, so a shut-down handle is a typedWireError.Stopped, not a panic.an_unprobed_child_reports_an_unknown_chain_progressand the rest of the module stay green.The core-side short-circuit (
wallet_childisNoneimplies return the cached snapshot) is exercised bysrc/node.rs's own tests, which cannot be reached from this crate.Local gate (SDK is its own workspace; a root
cargo testnever builds it):crates/onionwire-sdk/Cargo.lockis unchanged (no dependency change).crates/onionwire-sdk/src/lib.rscarries only the one rustfmt hunk inherited frommain(same diff count againstgit show HEAD:crates/onionwire-sdk/src/lib.rs).Generated bindings prove the surface:
uniffi-bindgen generate --library target/debug/libonionwire_sdk.so --language kotlinemitswhich is exactly what the Android polling card consumes.
sirius referenced this pull request2026-09-20 04:52:04 +00:00