wallet: derive readiness from the wallet's get_height, not a nonexistent get_info
monero-wallet-rpc does not implement get_info (-32601 Method not found); it exists on the daemon only. Every wallet therefore sat in syncing forever: no balance, spends refused, receipts never verified. Readiness is now the pair: - the wallet RPC's own get_height (its scanned height), and - the chain tip from the existing daemon client (GET /get_height). ready = height > 0 && (tip == 0 || height + 2 >= tip). The 2-block slack is deliberate: the tip moves every ~2 min and the two reads are not a snapshot. A daemon that does not answer, a missing height and -13 No wallet file are all not-ready, never an error banner. ChildConfig::daemon_probe_addr resolves a tip source for clearnet remotes (the wallet child already dials them); a .onion daemon is not dialled without the SOCKS child and stays fail-closed. docs/WALLET.md now documents the real rule. Tests cover -32601 get_info, equal tip, slack boundary, dead daemon and the no-wallet-file answer.
This commit is contained in:
parent
dddf74f274
commit
3aafaefae8
6 changed files with 476 additions and 159 deletions
16
src/tui.rs
16
src/tui.rs
|
|
@ -7694,8 +7694,22 @@ mod wallet_setup_config_tests {
|
|||
app.node.start_wallet_child().expect("start");
|
||||
|
||||
let height = Arc::new(AtomicU64::new(1111));
|
||||
let wallet = rt.block_on(mock_wallet_at(Arc::clone(&height), 9000));
|
||||
let (wallet, daemon) = rt.block_on(mock_wallet_at(Arc::clone(&height), 9000));
|
||||
test_install_wallet(&app.node, wallet);
|
||||
// Readiness compares the wallet's scanned height with a daemon tip, so
|
||||
// point the chain source at the stub the wallet mock returned.
|
||||
let (host, port) = daemon.rsplit_once(':').expect("host:port");
|
||||
app.node
|
||||
.set_wallet_child_config(&ChildConfig {
|
||||
source: ChainSource::Remote {
|
||||
host: host.to_string(),
|
||||
port: port.parse().expect("daemon port"),
|
||||
},
|
||||
wallet_rpc_bin: std::path::PathBuf::from("monero-wallet-rpc"),
|
||||
arti_bin: std::path::PathBuf::from("arti"),
|
||||
wallet_filename: "onionwire".into(),
|
||||
})
|
||||
.expect("point the chain source at the daemon stub");
|
||||
app.handle_key(key(KeyCode::F(7))).expect("F7");
|
||||
|
||||
wait_for_sync_line(&mut app, &rt, "sync 1111/9000");
|
||||
|
|
|
|||
Loading…
Reference in a new issue