Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit b292249

Browse files
reuse ForwardPaymentAction inside of HTLCInterceptedAction
1 parent 494a03c commit b292249

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/lsps2/service.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ enum HTLCInterceptedAction {
7878
OpenChannel(OpenChannelParams),
7979
/// The forwarding of the intercepted HTLC.
8080
ForwardHTLC(ChannelId),
81-
ForwardPayment(ChannelId, FeePayment),
81+
ForwardPayment(ForwardPaymentAction),
8282
}
8383

8484
/// The forwarding of a payment while skimming the JIT channel opening fee.
@@ -240,10 +240,11 @@ impl OutboundJITChannelState {
240240
opening_fee_msat: *opening_fee_msat,
241241
channel_id: *channel_id,
242242
};
243-
let forward_payment = HTLCInterceptedAction::ForwardPayment(
244-
*channel_id,
245-
FeePayment { htlcs, opening_fee_msat: *opening_fee_msat },
246-
);
243+
let forward_payment =
244+
HTLCInterceptedAction::ForwardPayment(ForwardPaymentAction(
245+
*channel_id,
246+
FeePayment { htlcs, opening_fee_msat: *opening_fee_msat },
247+
));
247248
Ok((pending_payment_forward, Some(forward_payment)))
248249
} else {
249250
let pending_payment = OutboundJITChannelState::PendingPayment {
@@ -732,8 +733,10 @@ where
732733
)?;
733734
},
734735
Ok(Some(HTLCInterceptedAction::ForwardPayment(
735-
channel_id,
736-
FeePayment { opening_fee_msat, htlcs },
736+
ForwardPaymentAction(
737+
channel_id,
738+
FeePayment { opening_fee_msat, htlcs },
739+
),
737740
))) => {
738741
let amounts_to_forward_msat =
739742
calculate_amount_to_forward_per_htlc(&htlcs, opening_fee_msat);
@@ -1462,7 +1465,10 @@ mod tests {
14621465
.unwrap();
14631466
assert!(matches!(new_state, OutboundJITChannelState::PendingPaymentForward { .. }));
14641467
match action {
1465-
Some(HTLCInterceptedAction::ForwardPayment(channel_id, payment)) => {
1468+
Some(HTLCInterceptedAction::ForwardPayment(ForwardPaymentAction(
1469+
channel_id,
1470+
payment,
1471+
))) => {
14661472
assert_eq!(channel_id, ChannelId([200; 32]));
14671473
assert_eq!(payment.opening_fee_msat, 10_000_000);
14681474
assert_eq!(

0 commit comments

Comments
 (0)