← Watch feed
Remove unnecessary update_add clone on Channel ser
What changed, and why it matters
This is a small code cleanup that removes an unnecessary clone (duplicate copy) of update_add data when serializing a Lightning channel to bytes. It changes the vector to hold references instead of owned copies, with no functional change to behavior or security.
Recommended action
No security action needed. Treat as normal code-quality/performance improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In lightning/src/ln/channel.rs serialization logic, the patch changes inbound_committed_update_adds from Vec
Changed components
lightning/src/ln/channel.rs serialization of pending inbound HTLCsInspect captured patch +2 / −2
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index 57f1020..306d3c9 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -14713,7 +14713,7 @@ where
}
}
let mut removed_htlc_attribution_data: Vec<&Option<AttributionData>> = Vec::new();
- let mut inbound_committed_update_adds: Vec<Option<msgs::UpdateAddHTLC>> = Vec::new();
+ let mut inbound_committed_update_adds: Vec<&Option<msgs::UpdateAddHTLC>> = Vec::new();
(self.context.pending_inbound_htlcs.len() as u64 - dropped_inbound_htlcs).write(writer)?;
for htlc in self.context.pending_inbound_htlcs.iter() {
if let &InboundHTLCState::RemoteAnnounced(_) = &htlc.state {
@@ -14735,7 +14735,7 @@ where
},
&InboundHTLCState::Committed { ref update_add_htlc_opt } => {
3u8.write(writer)?;
- inbound_committed_update_adds.push(update_add_htlc_opt.clone());
+ inbound_committed_update_adds.push(update_add_htlc_opt);
},
&InboundHTLCState::LocalRemoved(ref removal_reason) => {
4u8.write(writer)?;
Risk score
Our methodology →Why this scored 15/100
Human-validated context
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
No validated notes yet.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.