@@ -255,35 +255,38 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
255255 }).Info ("LDK node synced successfully" )
256256
257257 if ls .network == "bitcoin" {
258- // try to connect to some peers to retrieve P2P gossip data. TODO: Remove once LDK can correctly do gossip with CLN and Eclair nodes
259- // see https://github.com/lightningdevkit/rust-lightning/issues/3075
260- peers := []string {
261- "031b301307574bbe9b9ac7b79cbe1700e31e544513eae0b5d7497483083f99e581@45.79.192.236:9735" , // Olympus
262- "0364913d18a19c671bb36dd04d6ad5be0fe8f2894314c36a9db3f03c2d414907e1@192.243.215.102:9735" , // LQwD
263- "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735" , // WoS
264- "02fcc5bfc48e83f06c04483a2985e1c390cb0f35058baa875ad2053858b8e80dbd@35.239.148.251:9735" , // Blink
265- "027100442c3b79f606f80f322d98d499eefcb060599efc5d4ecb00209c2cb54190@3.230.33.224:9735" , // c=
266- "038a9e56512ec98da2b5789761f7af8f280baf98a09282360cd6ff1381b5e889bf@64.23.162.51:9735" , // Megalith LSP
267- }
268- logger .Logger .Info ("Connecting to some peers to retrieve P2P gossip data" )
269- for _ , peer := range peers {
270- parts := strings .FieldsFunc (peer , func (r rune ) bool { return r == '@' || r == ':' })
271- port , err := strconv .ParseUint (parts [2 ], 10 , 16 )
272- if err != nil {
273- logger .Logger .WithError (err ).Error ("Failed to parse port number" )
274- continue
258+ go func () {
259+ // try to connect to some peers in the background to retrieve P2P gossip data.
260+ // TODO: Remove once LDK can correctly do gossip with CLN and Eclair nodes
261+ // see https://github.com/lightningdevkit/rust-lightning/issues/3075
262+ peers := []string {
263+ "031b301307574bbe9b9ac7b79cbe1700e31e544513eae0b5d7497483083f99e581@45.79.192.236:9735" , // Olympus
264+ "0364913d18a19c671bb36dd04d6ad5be0fe8f2894314c36a9db3f03c2d414907e1@192.243.215.102:9735" , // LQwD
265+ "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735" , // WoS
266+ "02fcc5bfc48e83f06c04483a2985e1c390cb0f35058baa875ad2053858b8e80dbd@35.239.148.251:9735" , // Blink
267+ // "027100442c3b79f606f80f322d98d499eefcb060599efc5d4ecb00209c2cb54190@3.230.33.224:9735", // c=
268+ "038a9e56512ec98da2b5789761f7af8f280baf98a09282360cd6ff1381b5e889bf@64.23.162.51:9735" , // Megalith LSP
275269 }
276- err = ls .ConnectPeer (ctx , & lnclient.ConnectPeerRequest {
277- Pubkey : parts [0 ],
278- Address : parts [1 ],
279- Port : uint16 (port ),
280- })
281- if err != nil {
282- logger .Logger .WithFields (logrus.Fields {
283- "peer" : peer ,
284- }).WithError (err ).Error ("Failed to connect to peer" )
270+ logger .Logger .Info ("Connecting to some peers to retrieve P2P gossip data" )
271+ for _ , peer := range peers {
272+ parts := strings .FieldsFunc (peer , func (r rune ) bool { return r == '@' || r == ':' })
273+ port , err := strconv .ParseUint (parts [2 ], 10 , 16 )
274+ if err != nil {
275+ logger .Logger .WithError (err ).Error ("Failed to parse port number" )
276+ continue
277+ }
278+ err = ls .ConnectPeer (ctx , & lnclient.ConnectPeerRequest {
279+ Pubkey : parts [0 ],
280+ Address : parts [1 ],
281+ Port : uint16 (port ),
282+ })
283+ if err != nil {
284+ logger .Logger .WithFields (logrus.Fields {
285+ "peer" : peer ,
286+ }).WithError (err ).Error ("Failed to connect to peer" )
287+ }
285288 }
286- }
289+ }()
287290 }
288291
289292 // setup background sync
@@ -1644,8 +1647,10 @@ func deleteOldLDKLogs(ldkLogDir string) {
16441647}
16451648
16461649func (ls * LDKService ) GetNodeStatus (ctx context.Context ) (nodeStatus * lnclient.NodeStatus , err error ) {
1650+ status := ls .node .Status ()
16471651 return & lnclient.NodeStatus {
1648- InternalNodeStatus : ls .node .Status (),
1652+ IsReady : status .IsRunning && status .IsListening ,
1653+ InternalNodeStatus : status ,
16491654 }, nil
16501655}
16511656
0 commit comments