@@ -256,10 +256,9 @@ def open_channel(self, ch, fee_rate):
256256 src = self .lns [ch ["source" ]]
257257 tgt_uri = ln_uris [ch ["target" ]]
258258 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 } "
262260 while True :
261+ self .log .info (f"Sending channel open:\n { log } " )
263262 try :
264263 res = src .channel (
265264 pk = tgt_pk ,
@@ -268,20 +267,11 @@ def open_channel(self, ch, fee_rate):
268267 fee_rate = fee_rate ,
269268 )
270269 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' ]} " )
276272 break
277273 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..." )
285275 sleep (5 )
286276
287277 channels = sorted (ch_by_block [target_block ], key = lambda ch : ch ["id" ]["index" ])
@@ -301,6 +291,11 @@ def open_channel(self, ch, fee_rate):
301291 ch_threads .append (t )
302292
303293 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+
304299 self .log .info (f"Waiting for { len (channels )} channel opens in mempool..." )
305300 self .wait_until (
306301 lambda channels = channels : self .nodes [0 ].getmempoolinfo ()["size" ] >= len (channels ),
@@ -369,6 +364,7 @@ def update_policy(self, ln, txid_hex, policy, capacity):
369364 f" Failed updates: { res ['failed_updates' ]} \n txid: { txid_hex } \n policy:{ policy } \n retrying in 5 seconds..."
370365 )
371366 sleep (5 )
367+ continue
372368 break
373369 except Exception as e :
374370 self .log .info (f"Couldn't update channel policy for { ln .name } because { e } , retrying in 5 seconds..." )
0 commit comments