Skip to content

chore: add network graph dump on Lightning send errors#430

Open
jvsena42 wants to merge 3 commits intomasterfrom
chore/dump-graph-info
Open

chore: add network graph dump on Lightning send errors#430
jvsena42 wants to merge 3 commits intomasterfrom
chore/dump-graph-info

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Feb 4, 2026

Description

This PR adds comprehensive network graph debugging information when Lightning payments fail. When a send error occurs, the new dumpNetworkGraphInfo function logs:

  • Invoice info (payment hash)
  • Our node ID
  • Channel details (capacity, usable/announced status)
  • Connected peers
  • RGS sync configuration and timing
  • Network graph statistics (node/channel counts)
  • Trusted peer presence in the graph

This mirrors the existing Android implementation and helps diagnose routing failures.

For testing:
Try to pay a lightning invoice twice

Linked Issues/Tasks

N/A - Debugging enhancement

Screenshot / Video

N/A - Internal logging functionality

@claude

This comment has been minimized.

@jvsena42 jvsena42 marked this pull request as draft February 4, 2026 18:24
@jvsena42
Copy link
Member Author

jvsena42 commented Feb 4, 2026

Draft for testing

@jvsena42
Copy link
Member Author

jvsena42 commented Feb 5, 2026

I see iOS has a similar method dumpLdkLogs

@jvsena42 jvsena42 closed this Feb 5, 2026
@jvsena42
Copy link
Member Author

jvsena42 commented Feb 5, 2026

They have different info

*****LDK-NODE LOG******
[2026-02-05 10:29:43.842 UTC] INFOℹ️: ✅ Sync completed: type=onchainWallet height=61707 [LightningService.swift: listenForEvents(onEvent:) line: 1039]
[2026-02-05 10:29:43.842 UTC] INFOℹ️: Sync completed: onchainWallet at height 61707 [WalletViewModel.swift: start(walletIndex:) line: 179]
[2026-02-05 10:29:44.069 UTC] DEBUG: Starting transaction sync. - [LDK] [lightning_transaction_sync::electrum:92] [Logger.swift: log(record:) line: 171]
[2026-02-05 10:29:44.070 UTC] PERF: refreshCache() took 0.2 seconds on ldk queue [ServiceQueue.swift: background(_:_:functionName:) line: 58]
[2026-02-05 10:29:44.070 UTC] DEBUG: Checking 0 pending transfers to spending [BalanceManager.swift: getPendingChannelsSats(transfers:channels:balances:) line: 140]
[2026-02-05 10:29:44.070 UTC] DEBUG: Available channels: 1, Lightning balances: 1 [BalanceManager.swift: getPendingChannelsSats(transfers:channels:balances:) line: 141]
[2026-02-05 10:29:44.071 UTC] DEBUG: Active transfers: 0 [BalanceManager.swift: deriveBalanceState() line: 84]
[2026-02-05 10:29:44.071 UTC] DEBUG: Balances in ldk-node: onchain=73517 lightning=24903 [BalanceManager.swift: deriveBalanceState() line: 87]
[2026-02-05 10:29:44.071 UTC] DEBUG: Balances in state: onchain=73517 lightning=24903 toSavings=0 toSpending=0 lnSubtract=0 ordersOnchainSubtract=0 [BalanceManager.swift: deriveBalanceState() line: 90]
[2026-02-05 10:29:44.097 UTC] PERF: refreshCache() took 0.0 seconds on ldk queue [ServiceQueue.swift: background(_:_:functionName:) line: 58]
[2026-02-05 10:29:44.098 UTC] DEBUG: Checking 0 pending transfers to spending [BalanceManager.swift: getPendingChannelsSats(transfers:channels:balances:) line: 140]
[2026-02-05 10:29:44.098 UTC] DEBUG: Available channels: 1, Lightning balances: 1 [BalanceManager.swift: getPendingChannelsSats(transfers:channels:balances:) line: 141]
[2026-02-05 10:29:44.098 UTC] DEBUG: Active transfers: 0 [BalanceManager.swift: deriveBalanceState() line: 84]
[2026-02-05 10:29:44.098 UTC] DEBUG: Balances in ldk-node: onchain=73517 lightning=24903 [BalanceManager.swift: deriveBalanceState() line: 87]
[2026-02-05 10:29:44.098 UTC] DEBUG: Balances in state: onchain=73517 lightning=24903 toSavings=0 toSpending=0 lnSubtract=0 ordersOnchainSubtract=0 [BalanceManager.swift: deriveBalanceState() line: 90]
[2026-02-05 10:29:44.401 UTC] DEBUG: Finished transaction sync at tip 1ca7f073d004c7f20f18fbcc84670f172b229c8a6fab858444b9cfcf8f8a1437 in 331ms: 0 confirmed, 0 unconfirmed. - [LDK] [lightning_transaction_sync::electrum:222] [Logger.swift: log(record:) line: 171]
[2026-02-05 10:29:44.401 UTC] INFOℹ️: Sync of Lightning wallet finished in 332ms. - [LDK] [ldk_node::chain::electrum:501] [Logger.swift: log(record:) line: 173]
[2026-02-05 10:29:44.551 UTC] PERF: addPreActivityMetadata(_:) took 0.0 seconds on core queue [ServiceQueue.swift: background(_:_:functionName:) line: 58]
[2026-02-05 10:29:44.575 UTC] INFOℹ️: Paying bolt11: lnbcrt90n1p5cgu8adqqnp4q26m39zn6gsyryywps3yzja2zflxg7qm7fdx7e33h8m0p3gfnup8ypp5u3l09gcervs3ffcpjzm7rukhpjfwfmmeqaqn4mhhamjmqrs8z6yqsp5n7tx0gr75csz3ynn9c7fessw3q8cjuj6lysv2mwzst0updegtj9s9qyysgqcqzp2xqyz5vqrzjq29gjy9sqjrrp48tz7hj2e5vm4l2dukc4csf2mn6qm32u3hted5leapyqqqqqqqvn5qqqqlgqqqqqqgq2qdfpxm52mkan5h8rvpt5fnc7mwcnhx60p8rgqd6w533txdzu9w5m4qputx93y7tx3zaxxl7zzcsg6hh2w4kd0ngp7s3np3aw6vdvfwnspsxfdkr [LightningService.swift: send(bolt11:sats:params:) line: 485]
=== ROUTE NOT FOUND - NETWORK GRAPH DUMP ===

Invoice Info:
  - Payment Hash: e47ef2a3191b2114a70190b7e1f2d70c92e4ef7907413aeef7eee5b00e071688
  - Invoice: lnbcrt90n1p5cgu8adqqnp4q26m39zn6gsyryywps3yzja2zflxg7qm7fdx7e33h8m0p3gfnup8ypp5u3l09gcervs3ffcpjzm7rukhpjfwfmmeqaqn4mhhamjmqrs8z6yqsp5n7tx0gr75csz3ynn9c7fessw3q8cjuj6lysv2mwzst0updegtj9s9qyysgqcqzp2xqyz5vqrzjq29gjy9sqjrrp48tz7hj2e5vm4l2dukc4csf2mn6qm32u3hted5leapyqqqqqqqvn5qqqqlgqqqqqqgq2qdfpxm52mkan5h8rvpt5fnc7mwcnhx60p8rgqd6w533txdzu9w5m4qputx93y7tx3zaxxl7zzcsg6hh2w4kd0ngp7s3np3aw6vdvfwnspsxfdkr

Our Node Info:
  - Node ID: 03f48e6929404bee4a8b076aaeb1cab4ff639499487ec9b07fe964061bae4e7d37

Our Channels:
  Total channels: 1
  Channel 1:
    - Channel ID: 1301c59b779d198d9d6f66f896f7937761dcbe57b27a2837ee0742a47fb119bb
    - Counterparty: 028a8910b0048630d4eb17af25668cdd7ea6f2d8ae20956e7a06e2ae46ebcb69fc
    - Ready: true, Usable: true, Announced: false
    - Outbound: 24549000 msat, Inbound: 708621000 msat

  Channel Summary:
    - Usable channels: 1/1
    - Announced channels: 0/1
    - Total Outbound: 24549000 msat
    - Total Inbound: 708621000 msat

Our Peers:
  Total peers: 1
  Peer 1: 028a8910b0048630d4eb... @ 34.65.86.104:9400

RGS Configuration:
  - RGS Server URL: https://bitkit.stag0.blocktank.to/rgs/snapshot
  - Last RGS Snapshot: Never synced
  - WARNING: Network graph may be empty or stale!

RGS Network Graph Data:
  Total nodes: 0
  Total channels: 0

  Checking for trusted peers in network graph:
    MISSING: 028a8910b0048630d4eb... NOT in graph
  Summary: 0/1 trusted peers found in graph

  First 0 nodes:

=== END NETWORK GRAPH DUMP ===

@jvsena42 jvsena42 reopened this Feb 5, 2026
@jvsena42 jvsena42 marked this pull request as ready for review February 5, 2026 10:35
@jvsena42 jvsena42 requested a review from pwltr February 5, 2026 10:36
@jvsena42 jvsena42 self-assigned this Feb 5, 2026
@claude

This comment has been minimized.

1 similar comment
@claude

This comment has been minimized.

@claude
Copy link

claude bot commented Feb 5, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant