What changed, and why it matters
This commit is a straightforward internal code cleanup. It removes a thin wrapper struct named OutboundCRChannel and uses the underlying ChannelOrder type directly in a hash map. There is no change to user-facing behavior, no bug fix, and no security-related modification.
No security action needed; treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors lightning-liquidity/src/lsps1/peer_state.rs by replacing HashMap
Changed components
lightning-liquidity/src/lsps1/peer_state.rsInspect captured patch +4 / −16
diff --git a/lightning-liquidity/src/lsps1/peer_state.rs b/lightning-liquidity/src/lsps1/peer_state.rs
index 9adc3c9..8f7c5a9 100644
--- a/lightning-liquidity/src/lsps1/peer_state.rs
+++ b/lightning-liquidity/src/lsps1/peer_state.rs
@@ -18,7 +18,7 @@ use core::fmt;
#[derive(Default)]
pub(super) struct PeerState {
- outbound_channels_by_order_id: HashMap<LSPS1OrderId, OutboundCRChannel>,
+ outbound_channels_by_order_id: HashMap<LSPS1OrderId, ChannelOrder>,
pending_requests: HashMap<LSPSRequestId, LSPS1Request>,
}
@@ -27,12 +27,12 @@ impl PeerState {
&mut self, order_id: LSPS1OrderId, order_params: LSPS1OrderParams,
created_at: LSPSDateTime, payment_details: LSPS1PaymentInfo,
) {
- let channel = OutboundCRChannel::new(order_params, created_at, payment_details);
- self.outbound_channels_by_order_id.insert(order_id, channel);
+ let channel_order = ChannelOrder { order_params, created_at, payment_details };
+ self.outbound_channels_by_order_id.insert(order_id, channel_order);
}
pub(super) fn get_order<'a>(&'a self, order_id: &LSPS1OrderId) -> Option<&'a ChannelOrder> {
- self.outbound_channels_by_order_id.get(order_id).map(|channel| &channel.order)
+ self.outbound_channels_by_order_id.get(order_id)
}
pub(super) fn register_request(
@@ -76,15 +76,3 @@ pub(super) struct ChannelOrder {
pub(super) created_at: LSPSDateTime,
pub(super) payment_details: LSPS1PaymentInfo,
}
-
-struct OutboundCRChannel {
- order: ChannelOrder,
-}
-
-impl OutboundCRChannel {
- fn new(
- order_params: LSPS1OrderParams, created_at: LSPSDateTime, payment_details: LSPS1PaymentInfo,
- ) -> Self {
- Self { order: ChannelOrder { order_params, created_at, payment_details } }
- }
-}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.