Build 59: start the nostr service immediately on wallet open (fix slow connect)
The Nym/relay connection could take up to a full SYNC_DELAY (60s) to even start: the nostr service was kicked off deep inside the wallet sync loop, behind the grin node-sync checks and !sync_error, so opening a wallet left the profile on "Connecting..." until the next 60s sync tick (or never, while the node errored). Move the (idempotent) service start to the very top of the loop, right after the open check - independent of node sync - so the connection comes up right away.
This commit is contained in:
+13
-8
@@ -1857,6 +1857,19 @@ fn start_sync(wallet: Wallet) -> Thread {
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the nostr payment-messaging service the moment the wallet is
|
||||
// open — BEFORE (and independent of) the grin node sync. Previously
|
||||
// this lived deep in the sync body behind `!sync_error` and the node
|
||||
// checks, so the Nym/relay connection could wait up to a full
|
||||
// SYNC_DELAY (60s) — or never start while the node errored — leaving
|
||||
// the profile stuck on "Connecting…". Idempotent.
|
||||
if let Some(service) = wallet.nostr_service() {
|
||||
service.start(wallet.clone());
|
||||
// Auto-cancel/expire stale pending transactions (frees outputs
|
||||
// locked by stale sends).
|
||||
service.expire_stale(&wallet);
|
||||
}
|
||||
|
||||
// Check integrated node state.
|
||||
if wallet.get_current_connection() == ConnectionMethod::Integrated {
|
||||
let not_enabled = !Node::is_running() || Node::is_stopping();
|
||||
@@ -1900,14 +1913,6 @@ fn start_sync(wallet: Wallet) -> Thread {
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Start nostr payment-messaging service (idempotent).
|
||||
if let Some(service) = wallet.nostr_service() {
|
||||
service.start(wallet.clone());
|
||||
// Auto-cancel/expire transactions left pending past the
|
||||
// configured window (frees outputs locked by stale sends).
|
||||
service.expire_stale(&wallet);
|
||||
}
|
||||
}
|
||||
|
||||
// Sync wallet from node.
|
||||
|
||||
Reference in New Issue
Block a user