bitkit icon indicating copy to clipboard operation
bitkit copied to clipboard

[Bug]: User-added LN peers are not backed up

Open catch-21 opened this issue 1 year ago • 1 comments

Describe the bug

When I add a new LN peer and then restore my wallet the peer is not persisted. This is most important when there's a connection with an LSP (not blocktank) because without the peer then the connection is unusable.

Reproduce

  1. Request liquidity from LNBig to establish a new connection
  2. Observe LN connection that Is Usable? Yes
  3. Restore wallet
  4. Observe LN connection is now Is Usable? No (this is because the peer is not restored)
  5. At this stage, you can scan to re-add the peer to get the connection usable again, but you shouldn't need to.

Screenshots / Recording

No response

Operating system

Android 13 TKQ1.221114.001

Bitkit version

v127

Log output

No response

catch-21 avatar Jul 01 '24 15:07 catch-21

Fix here https://github.com/synonymdev/react-native-ldk/pull/257

Jasonvdb avatar Jul 02 '24 08:07 Jasonvdb

I've tried verifying this with v130 d8f96e7d6475d2eef04ae08f9d9dd2c8894a8218 but the logs do not show me this peer after restore. I followed these steps:

  • Scan qr for 039edc94987c8f3adc28dab455efc00dea876089a120f573bd0b03c40d9d3fb1e1@edge-4.LNBiG.com:9735
  • Observe the following in ldk logs
2024-07-26 11:46:22 DEBUG (JS): addPeer() success. {"pubKey":"039edc94987c8f3adc28dab455efc00dea876089a120f573bd0b03c40d9d3fb1e1","address":"edge-4.LNBiG.com","port":9735,"timeout":5000}
2024-07-26 11:46:22 DEBUG (LDK): Finished noise handshake for connection with 039edc94987c8f3adc28dab455efc00dea876089a120f573bd0b03c40d9d3fb1e1 (lightning::ln::peer_handler 1418)
2024-07-26 11:46:22 DEBUG (KOTLIN): Checking for dropped peers
2024-07-26 11:46:22 DEBUG (JS): readFromFile() success. "peers.json"
2024-07-26 11:46:22 DEBUG (KOTLIN): Success: file_write_success
2024-07-26 11:46:22 DEBUG (JS): writeToFile() success. "peers.json"
2024-07-26 11:46:22 DEBUG (KOTLIN): Sending backup to https://blocktank.synonym.to/backups-ldk/v1/persist?network=bitcoin&label=peers
2024-07-26 11:46:22 DEBUG (KOTLIN): Remote persist success for peers
2024-07-26 11:46:22 DEBUG (KOTLIN): Remote persist success for peers after 1 attempts
2024-07-26 11:46:22 INFO (LDK): Received peer Init message from 039edc94987c8f3adc28dab455efc00dea876089a120f573bd0b03c40d9d3fb1e1: DataLossProtect: required, InitialRoutingSync: not supported, UpfrontShutdownScript: supported, GossipQueries: supported, VariableLengthOnion: required, StaticRemoteKey: required, PaymentSecret: required, BasicMPP: supported, Wumbo: supported, AnchorsNonzeroFeeHtlcTx: not supported, AnchorsZeroFeeHtlcTx: supported, RouteBlinding: supported, ShutdownAnySegwit: supported, Taproot: supported, OnionMessages: not supported, ChannelType: supported, SCIDPrivacy: not supported, ZeroConf: not supported, unknown flags: supported (lightning::ln::peer_handler 1586)
2024-07-26 11:46:22 DEBUG (LDK): Generating channel_reestablish events for 039edc94987c8f3adc28dab455efc00dea876089a120f573bd0b03c40d9d3fb1e1 (lightning::ln::channelmanager 9003)
  • Wait a while (>30 minutes) for restore to occur
  • Wipe and restore wallet
  • Search ldk logs for this peer 039edc94987c8f3adc28dab455efc00dea876089a120f573bd0b03c40d9d3fb1e1 but no trace.

bitkit_ldk_logs_1721991010677.zip

catch-21 avatar Jul 26 '24 10:07 catch-21

Ok thanks looking into it now. Strange because I see the peer file was both uploaded and restored there so not sure where this peer went missing.

Jasonvdb avatar Jul 26 '24 11:07 Jasonvdb

related: synonymdev/react-native-ldk/issues/259

ovitrif avatar Aug 08 '24 13:08 ovitrif

Fix here: https://github.com/synonymdev/bitkit/pull/2199

tl;dr the remote backups and rn-ldk was working fine the whole time, it was an optimisation from 2 years back that was interfering.

Jasonvdb avatar Sep 05 '24 11:09 Jasonvdb

thanks

JeanlChristophe avatar Sep 05 '24 12:09 JeanlChristophe

JC Verified on v134

catch-21 avatar Sep 06 '24 10:09 catch-21