@@ -256,10 +256,9 @@ def open_channel(self, ch, fee_rate):
256
256
src = self .lns [ch ["source" ]]
257
257
tgt_uri = ln_uris [ch ["target" ]]
258
258
tgt_pk , _ = tgt_uri .split ("@" )
259
- self .log .info (
260
- f"Sending channel open from { ch ['source' ]} -> { ch ['target' ]} with fee_rate={ fee_rate } "
261
- )
259
+ log = f" { ch ['source' ]} -> { ch ['target' ]} \n { ch ['id' ]} fee: { fee_rate } "
262
260
while True :
261
+ self .log .info (f"Sending channel open:\n { log } " )
263
262
try :
264
263
res = src .channel (
265
264
pk = tgt_pk ,
@@ -268,20 +267,11 @@ def open_channel(self, ch, fee_rate):
268
267
fee_rate = fee_rate ,
269
268
)
270
269
ch ["txid" ] = res ["txid" ]
271
- self .log .info (
272
- f"Channel open { ch ['source' ]} -> { ch ['target' ]} \n "
273
- + f"outpoint={ res ['outpoint' ]} \n "
274
- + f"expected channel id: { ch ['id' ]} "
275
- )
270
+ ch ["outpoint" ] = res ["outpoint" ]
271
+ self .log .info (f"Channel open success:\n { log } \n outpoint: { res ['outpoint' ]} " )
276
272
break
277
273
except Exception as e :
278
- ch ["txid" ] = "N/A"
279
- self .log .info (
280
- "Couldn't open channel:\n "
281
- + f"From { ch ['source' ]} -> { ch ['target' ]} fee_rate={ fee_rate } \n "
282
- + f"{ e } \n "
283
- + "Retrying in 5 seconds..."
284
- )
274
+ self .log .info (f"Couldn't open channel:\n { log } \n { e } \n Retrying in 5 seconds..." )
285
275
sleep (5 )
286
276
287
277
channels = sorted (ch_by_block [target_block ], key = lambda ch : ch ["id" ]["index" ])
@@ -301,6 +291,11 @@ def open_channel(self, ch, fee_rate):
301
291
ch_threads .append (t )
302
292
303
293
all (thread .join () is None for thread in ch_threads )
294
+ for ch in channels :
295
+ if ch ["outpoint" ][- 2 :] != ":0" :
296
+ self .log .error (f"Channel open outpoint not tx output index 0\n { ch } " )
297
+ raise Exception ("Channel determinism ruined, abort!" )
298
+
304
299
self .log .info (f"Waiting for { len (channels )} channel opens in mempool..." )
305
300
self .wait_until (
306
301
lambda channels = channels : self .nodes [0 ].getmempoolinfo ()["size" ] >= len (channels ),
@@ -369,6 +364,7 @@ def update_policy(self, ln, txid_hex, policy, capacity):
369
364
f" Failed updates: { res ['failed_updates' ]} \n txid: { txid_hex } \n policy:{ policy } \n retrying in 5 seconds..."
370
365
)
371
366
sleep (5 )
367
+ continue
372
368
break
373
369
except Exception as e :
374
370
self .log .info (f"Couldn't update channel policy for { ln .name } because { e } , retrying in 5 seconds..." )
0 commit comments