Skip to content

Commit 6555b69

Browse files
committed
f Test regular forwards to priv channels
1 parent 212acad commit 6555b69

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

src/builder.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,11 @@ fn build_with_store_internal(
10931093

10941094
// If we act as an LSPS2 service, we allow forwarding to unnannounced channels.
10951095
user_config.accept_forwards_to_priv_channels = true;
1096+
1097+
// If we act as an LSPS2 service, set the HTLC-value-in-flight to 100% of the channel value
1098+
// to ensure we can forward the initial payment.
1099+
user_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
1100+
100;
10961101
}
10971102

10981103
let message_router =

src/liquidity.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,14 @@ where
675675

676676
let mut config = *self.channel_manager.get_current_default_configuration();
677677

678-
// Set the HTLC-value-in-flight to 100% of the channel value to ensure we can
679-
// forward the payment.
680-
config
681-
.channel_handshake_config
682-
.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
678+
// We set these LSP-specific values during Node building, here we're making sure it's actually set.
679+
debug_assert_eq!(
680+
config
681+
.channel_handshake_config
682+
.max_inbound_htlc_value_in_flight_percent_of_channel,
683+
100
684+
);
685+
debug_assert!(config.accept_forwards_to_priv_channels);
683686

684687
// We set the forwarding fee to 0 for now as we're getting paid by the channel fee.
685688
//

tests/integration_tests_rust.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,22 @@ fn lsps2_client_service_integration() {
11451145
(expected_received_amount_msat + expected_channel_overprovisioning_msat) / 1000;
11461146
let channel_value_sats = client_node.list_channels().first().unwrap().channel_value_sats;
11471147
assert_eq!(channel_value_sats, expected_channel_size_sat);
1148+
1149+
println!("Generating regular invoice!");
1150+
let invoice_description =
1151+
Bolt11InvoiceDescription::Direct(Description::new(String::from("asdf")).unwrap());
1152+
let amount_msat = 5_000_000;
1153+
let invoice = client_node
1154+
.bolt11_payment()
1155+
.receive(amount_msat, &invoice_description.into(), 1024)
1156+
.unwrap();
1157+
1158+
// Have the payer_node pay the invoice, to check regular forwards service_node -> client_node
1159+
// are working as expected.
1160+
println!("Paying regular invoice!");
1161+
let payment_id = payer_node.bolt11_payment().send(&invoice, None).unwrap();
1162+
expect_payment_successful_event!(payer_node, Some(payment_id), None);
1163+
expect_payment_received_event!(client_node, amount_msat);
11481164
}
11491165

11501166
#[test]

0 commit comments

Comments
 (0)