@@ -444,8 +444,20 @@ static void check_mutual_splice_locked(struct peer *peer)
444444
445445 if (short_channel_id_eq (peer -> short_channel_ids [LOCAL ],
446446 peer -> splice_state -> short_channel_id ))
447- peer_failed_warn (peer -> pps , & peer -> channel_id ,
448- "Duplicate splice_locked events detected" );
447+ peer_failed_err (peer -> pps , & peer -> channel_id ,
448+ "Duplicate splice_locked events detected"
449+ " by scid check" );
450+
451+ if (!peer -> splice_state -> remote_locked_txid
452+ || !bitcoin_txid_eq (peer -> splice_state -> remote_locked_txid ,
453+ & peer -> splice_state -> locked_txid ))
454+ peer_failed_err (peer -> pps , & peer -> channel_id ,
455+ "splice_locked message txid %s does not match"
456+ " our locked txid %s" ,
457+ fmt_bitcoin_txid (tmpctx ,
458+ peer -> splice_state -> remote_locked_txid ),
459+ fmt_bitcoin_txid (tmpctx ,
460+ & peer -> splice_state -> locked_txid ));
449461
450462 peer -> splice_state -> await_commitment_succcess = true;
451463
@@ -473,7 +485,7 @@ static void check_mutual_splice_locked(struct peer *peer)
473485 inflight = peer -> splice_state -> inflights [i ];
474486
475487 if (!inflight )
476- peer_failed_warn (peer -> pps , & peer -> channel_id ,
488+ peer_failed_err (peer -> pps , & peer -> channel_id ,
477489 "Unable to find inflight txid amoung %zu"
478490 " inflights. new funding txid: %s" ,
479491 tal_count (peer -> splice_state -> inflights ),
@@ -487,7 +499,7 @@ static void check_mutual_splice_locked(struct peer *peer)
487499 inflight -> amnt ,
488500 inflight -> splice_amnt );
489501 if (error )
490- peer_failed_warn (peer -> pps , & peer -> channel_id ,
502+ peer_failed_err (peer -> pps , & peer -> channel_id ,
491503 "Splice lock unable to update funding. %s" ,
492504 error );
493505
@@ -508,6 +520,7 @@ static void check_mutual_splice_locked(struct peer *peer)
508520
509521 peer -> splice_state -> inflights = tal_free (peer -> splice_state -> inflights );
510522 peer -> splice_state -> count = 0 ;
523+ peer -> splice_state -> remote_locked_txid = tal_free (peer -> splice_state -> remote_locked_txid );
511524}
512525
513526/* Our peer told us they saw our splice confirm on chain with `splice_locked`.
@@ -522,6 +535,16 @@ static void handle_peer_splice_locked(struct peer *peer, const u8 *msg)
522535 peer_failed_warn (peer -> pps , & peer -> channel_id ,
523536 "Bad splice_locked %s" , tal_hex (msg , msg ));
524537
538+ if (peer -> splice_state -> remote_locked_txid )
539+ peer_failed_err (peer -> pps , & chanid ,
540+ "Peer sent duplicate splice_locked message %s" ,
541+ tal_hex (tmpctx , msg ));
542+
543+ peer -> splice_state -> remote_locked_txid = tal (peer -> splice_state ,
544+ struct bitcoin_txid );
545+
546+ * peer -> splice_state -> remote_locked_txid = splice_txid ;
547+
525548 if (!channel_id_eq (& chanid , & peer -> channel_id ))
526549 peer_failed_err (peer -> pps , & chanid ,
527550 "Wrong splice lock channel id in %s "
0 commit comments