Skip to content

Commit 4c1b4a1

Browse files
fixup: on lsps1, don't count pending_requests as an active flow.
the service has not responded yet, so don't count that for DoS protection purposes
1 parent b522194 commit 4c1b4a1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning-liquidity/src/lsps1/service.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,17 @@ where
174174
&self.config
175175
}
176176

177+
/// Returns whether the peer currently has any active LSPS1 order flows.
178+
///
179+
/// An order is considered active only after we have validated the client's
180+
/// `CreateOrder` request and replied with a `CreateOrder` response containing
181+
/// an `order_id`.
182+
/// Pending requests that are still awaiting our response are deliberately NOT counted.
177183
pub(crate) fn has_active_requests(&self, counterparty_node_id: &PublicKey) -> bool {
178184
let outer_state_lock = self.per_peer_state.read().unwrap();
179185
outer_state_lock.get(counterparty_node_id).map_or(false, |inner| {
180186
let peer_state = inner.lock().unwrap();
181-
!(peer_state.pending_requests.is_empty()
182-
&& peer_state.outbound_channels_by_order_id.is_empty())
187+
!peer_state.outbound_channels_by_order_id.is_empty()
183188
})
184189
}
185190

0 commit comments

Comments
 (0)