@@ -681,6 +681,22 @@ static bool channel_announcement_negotiate(struct peer *peer)
681681 return sent_announcement ;
682682}
683683
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+
684700/* Call this method when splice_locked status are changed. If both sides have
685701 * splice_locked'ed than this function consumes the `splice_locked_ready` values
686702 * 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)
841857
842858 peer -> tx_sigs_allowed = false;
843859 peer -> channel_ready [REMOTE ] = true;
860+ check_mutual_channel_ready (peer );
844861 if (tlvs -> short_channel_id != NULL ) {
845862 status_debug (
846863 "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)
52385255 peer_write (peer -> pps , take (msg ));
52395256
52405257 peer -> channel_ready [LOCAL ] = true;
5258+ check_mutual_channel_ready (peer );
52415259 }
52425260 else if (splicing && !peer -> splice_state -> locked_ready [LOCAL ]) {
52435261 assert (scid );
0 commit comments