@@ -681,6 +681,22 @@ static bool channel_announcement_negotiate(struct peer *peer)
681
681
return sent_announcement ;
682
682
}
683
683
684
+ /* Call this method when channel_ready status are changed. */
685
+ static void check_mutual_channel_ready (struct peer * peer )
686
+ {
687
+ const u8 * msg ;
688
+ if (peer -> channel_ready [LOCAL ] && peer -> channel_ready [REMOTE ]) {
689
+ /* Make sure the hsmd agrees that this outpoint is
690
+ * sufficiently buried. */
691
+ msg = towire_hsmd_sync_outpoint (NULL , & peer -> channel -> funding );
692
+ msg = hsm_req (tmpctx , take (msg ));
693
+ if (!fromwire_hsmd_sync_outpoint_reply (msg ))
694
+ status_failed (STATUS_FAIL_HSM_IO ,
695
+ "Bad hsmd_sync_outpoint_reply: %s" ,
696
+ tal_hex (tmpctx , msg ));
697
+ }
698
+ }
699
+
684
700
/* Call this method when splice_locked status are changed. If both sides have
685
701
* splice_locked'ed than this function consumes the `splice_locked_ready` values
686
702
* and considers the channel funding to be switched to the splice tx. */
@@ -841,6 +857,7 @@ static void handle_peer_channel_ready(struct peer *peer, const u8 *msg)
841
857
842
858
peer -> tx_sigs_allowed = false;
843
859
peer -> channel_ready [REMOTE ] = true;
860
+ check_mutual_channel_ready (peer );
844
861
if (tlvs -> short_channel_id != NULL ) {
845
862
status_debug (
846
863
"Peer told us that they'll use alias=%s for this channel" ,
@@ -5238,6 +5255,7 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
5238
5255
peer_write (peer -> pps , take (msg ));
5239
5256
5240
5257
peer -> channel_ready [LOCAL ] = true;
5258
+ check_mutual_channel_ready (peer );
5241
5259
}
5242
5260
else if (splicing && !peer -> splice_state -> locked_ready [LOCAL ]) {
5243
5261
assert (scid );
0 commit comments