@@ -330,22 +330,18 @@ static enum watch_result funding_spent(struct channel *channel,
330330 const struct block * block );
331331
332332/* We coop-closed channel: if another inflight confirms, force close */
333- static enum watch_result closed_inflight_depth_cb (struct lightningd * ld ,
334- const struct bitcoin_txid * txid ,
335- const struct bitcoin_tx * tx ,
336- unsigned int depth ,
337- struct channel_inflight * inflight )
333+ static void closed_inflight_splice_found (struct lightningd * ld ,
334+ const struct bitcoin_tx * tx ,
335+ u32 outnum ,
336+ const struct txlocator * loc ,
337+ struct channel_inflight * inflight )
338338{
339- if (depth == 0 )
340- return KEEP_WATCHING ;
341-
342339 /* This is now the main tx. */
343340 update_channel_from_inflight (ld , inflight -> channel , inflight , false);
344341 channel_fail_saw_onchain (inflight -> channel ,
345342 REASON_UNKNOWN ,
346343 tx ,
347344 "Inflight tx confirmed after mutual close" );
348- return DELETE_WATCH ;
349345}
350346
351347void drop_to_chain (struct lightningd * ld , struct channel * channel ,
@@ -490,9 +486,15 @@ void drop_to_chain(struct lightningd *ld, struct channel *channel,
490486 & channel -> funding )) {
491487 continue ;
492488 }
493- watch_txid (inflight , ld -> topology ,
494- & inflight -> funding -> outpoint .txid ,
495- closed_inflight_depth_cb , inflight );
489+ const u8 * funding_wscript = bitcoin_redeem_2of2 (tmpctx ,
490+ & channel -> local_funding_pubkey ,
491+ inflight -> funding -> splice_remote_funding );
492+ watch_scriptpubkey (inflight , ld -> topology ,
493+ take (scriptpubkey_p2wsh (NULL , funding_wscript )),
494+ & inflight -> funding -> outpoint ,
495+ inflight -> funding -> total_funds ,
496+ closed_inflight_splice_found ,
497+ inflight );
496498 }
497499 }
498500}
0 commit comments