From 6b418705e1087dee82a0f2f931f7c6038c421117 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Tue, 17 Jun 2025 17:51:28 -0500 Subject: [PATCH 1/2] Rename COMMITMENT_SIGNED_BATCH_LIMIT The constant is not specific to commitment_signed but rather to start_batch in general. --- lightning/src/ln/peer_handler.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 73c831884f9..b6d13fb0d66 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -2204,8 +2204,8 @@ where .into()); } - const COMMITMENT_SIGNED_BATCH_LIMIT: usize = 20; - if batch_size > COMMITMENT_SIGNED_BATCH_LIMIT { + const BATCH_SIZE_LIMIT: usize = 20; + if batch_size > BATCH_SIZE_LIMIT { let error = format!( "Peer {} sent start_batch for channel {} exceeding the limit", log_pubkey!(their_node_id), From 3a990207187a93fc55d815c582d175c8810d930c Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Tue, 17 Jun 2025 17:56:32 -0500 Subject: [PATCH 2/2] Ignore start_batch for missing or unexpected message_type The spec was updated to ignore start_batch if message_type is missing or not that of commitment_signed. --- lightning/src/ln/peer_handler.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index b6d13fb0d66..d23cc19f4d9 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -2227,19 +2227,13 @@ where MessageBatchImpl::CommitmentSigned(messages) }, _ => { - let error = format!( - "Peer {} sent start_batch for channel {} without a known message type", + log_debug!( + logger, + "Peer {} sent start_batch for channel {} without a known message type; ignoring", log_pubkey!(their_node_id), - &msg.channel_id + &msg.channel_id, ); - log_debug!(logger, "{}", error); - return Err(LightningError { - err: error.clone(), - action: msgs::ErrorAction::DisconnectPeerWithWarning { - msg: msgs::WarningMessage { channel_id: msg.channel_id, data: error }, - }, - } - .into()); + return Ok(None); }, };