Skip to content

bug: node unstable on high-latency network #1293

Description

@ovitrif

What happened?

Reported by dzdidi in Slack: https://synonymworkspace.slack.com/archives/C07BJ7DNPCG/p1789588670436139

On a high-latency link to bitkit.to:9999 (both reporters connect across the Atlantic), App Status does not turn green for minutes. "Bitcoin Node" shows Connecting…, the Electrum Server screen flips between connected and disconnected, and "Lightning Node" can sit on Starting for minutes. It eventually settles after ~10 min of retries. Jacobo sees it on WiFi only; on a good day everything is up in about 7 s for him.

Logs show why:

  • Incremental on-chain syncs take 5–23 s on that link. The ldk-node fork deadlines are BDK_WALLET_SYNC_TIMEOUT_SECS = 20 and LDK_WALLET_SYNC_TIMEOUT_SECS = 10, so the first sync after a node start hits Incremental sync of on-chain wallet timed out about half the time. The app logs Error executing 'sync' [A wallet operation timed out], shows the node as disconnected, and retries every 15 s.
  • The external pathfinding scores cache read during node build has no short timeout and is fatal: two rebuilds died after ~5 min with Node setup error [LDK Build error: Read failed.] after the VSS getObject request stalled.
  • Env.walletSyncIntervalSecs = 10 is shorter than a sync on that link, so the node syncs almost continuously (Sync in progress, skipping).

Sync is Electrum only; the mempool.space, feeds.synonym.to and api1.blocktank.to failures in the same logs come from widgets and rates and are not on the node path.

Expected behavior

  • A slow sync is shown as slow or syncing, not as a disconnected Bitcoin node.
  • A stalled read of the optional pathfinding scores cache never blocks or fails node startup.
  • Users on slow links can raise the sync deadlines and interval themselves, guided by support, without a new release.

What needs to happen

Hard constraint: shipped defaults do not change. The current constants have run in production since the native rewrite (January 2026) and work for wallets on normal links. The fix makes the values tunable per device so affected users adjust them; ldk-node items live in the team fork synonymdev/ldk-node.

  • ldk-node fork: add wallet_sync_timeout_secs and lightning_sync_timeout_secs to ElectrumSyncConfig over FFI, following connection_timeout_secs; default to the current 20 s / 10 s and read them in chain/electrum.rs instead of the constants.
  • ldk-node fork: make the external pathfinding scores cache read non-fatal at build time and bound it with EXTERNAL_PATHFINDING_SCORES_SYNC_TIMEOUT_SECS.
  • Android: persist sync interval, Electrum connection timeout and both sync deadlines in settings with the current Env values as defaults, pass them from LightningService.configureChainSource, and expose them on Advanced › Electrum Server when dev mode is on; saving restarts the node like a server change does.
  • Android: show a sync timeout as slow/syncing instead of disconnected in App Status and on the Electrum Server screen.

Logs / Screenshots / Recordings

logs: bitkit_logs_2026-09-16_20-32-42 (private DM).
Key files: bitkit_2026-09-16_19-49-04.log, bitkit_2026-09-16_20-03-40.log, support_snapshot.json.

Bitkit Version

2.4.1 (188), mainnet, ldk-node fork 0.7.0-rc.66

Device / OS

Android 17 (API 37)

Reproducibility

Consistent for dzdidi over several days; Jacobo on WiFi only, not every day. Needs a high-latency link to bitkit.to:9999; more wallet history makes it worse because each sync does more round trips.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions