Skip to content

Commit ddb8101

Browse files
committed
f: add hold_outbound_htlcs_at_next_hop flag
1 parent 447cd82 commit ddb8101

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ pub struct Config {
181181
pub route_parameters: Option<RouteParametersConfig>,
182182
/// Whether to enable the static invoice service to support async payment reception for clients.
183183
pub async_payment_services_enabled: bool,
184+
/// If this is set to true, then if we as an often-offline payer receive a [`StaticInvoice`] to
185+
/// pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel
186+
/// counterparty(s) that support the `htlc_hold` feature. This allows our node to go offline once
187+
/// the HTLCs are locked in even though the recipient may not yet be online to receive them.
188+
pub hold_outbound_htlcs_at_next_hop: bool,
184189
}
185190

186191
impl Default for Config {
@@ -196,6 +201,7 @@ impl Default for Config {
196201
route_parameters: None,
197202
node_alias: None,
198203
async_payment_services_enabled: false,
204+
hold_outbound_htlcs_at_next_hop: false,
199205
}
200206
}
201207
}
@@ -333,6 +339,9 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig {
333339
if config.async_payment_services_enabled {
334340
user_config.enable_htlc_hold = true;
335341
}
342+
if config.hold_outbound_htlcs_at_next_hop {
343+
user_config.hold_outbound_htlcs_at_next_hop = true;
344+
}
336345

337346
user_config
338347
}

tests/integration_tests_rust.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ fn async_payment() {
11391139
let mut config_sender = random_config(true);
11401140
config_sender.node_config.listening_addresses = None;
11411141
config_sender.node_config.node_alias = None;
1142+
config_sender.node_config.hold_outbound_htlcs_at_next_hop = true;
11421143
config_sender.log_writer =
11431144
TestLogWriter::Custom(Arc::new(MultiNodeLogger::new("sender ".to_string())));
11441145
let node_sender = setup_node(&chain_source, config_sender, None);

0 commit comments

Comments
 (0)