Skip to content

Commit 1d2b0ed

Browse files
committed
Return an error when the intercept SCID is unknown to the LSPS2 service
HTLCs can be intercepted for multiple reasons unrelated to this handler: - Other HTLC interceptors might have generated intercept SCIDs. - The SCID of a closed channel might have fallen into the fake SCID namespace. The LSPS2 handler needs to indicate whether the specific SCID was known to it, so other handlers can be called or the HTLC can be failed back.
1 parent b6607a7 commit 1d2b0ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lightning-liquidity/src/lsps2/service.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ where
981981
/// Will generate a [`LSPS2ServiceEvent::OpenChannel`] event if the intercept scid matches a payment we are expected
982982
/// and the payment amount is correct and the offer has not expired.
983983
///
984-
/// Will do nothing if the intercept scid does not match any of the ones we gave out.
984+
/// Will return an error if the intercept scid does not match any of the ones we gave out.
985985
///
986986
/// [`Event::HTLCIntercepted`]: lightning::events::Event::HTLCIntercepted
987987
/// [`LSPS2ServiceEvent::OpenChannel`]: crate::lsps2::event::LSPS2ServiceEvent::OpenChannel
@@ -1067,6 +1067,10 @@ where
10671067
});
10681068
},
10691069
}
1070+
} else {
1071+
return Err(APIError::APIMisuseError {
1072+
err: format!("Unknown scid provided: {}", intercept_scid),
1073+
});
10701074
}
10711075

10721076
if let Some(counterparty_node_id) = should_persist {

0 commit comments

Comments
 (0)