Skip to content

Commit 38685db

Browse files
Add config flag for held outbound HTLCs
If the flag is set to true, then if we as an often-offline payer receive a static invoice to pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel counterparty(s) that support the feature. This allows our node to go offline once the HTLCs are locked in even though the recipient may not yet be online to receive them.
1 parent f988dca commit 38685db

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

fuzz/src/full_stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
10481048
// our network key
10491049
ext_from_hex("0100000000000000000000000000000000000000000000000000000000000000", &mut test);
10501050
// config
1051-
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff000100000000", &mut test);
1051+
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff00010000000000", &mut test);
10521052

10531053
// new outbound connection with id 0
10541054
ext_from_hex("00", &mut test);
@@ -1502,7 +1502,7 @@ fn gossip_exchange_seed() -> Vec<u8> {
15021502
// our network key
15031503
ext_from_hex("0100000000000000000000000000000000000000000000000000000000000000", &mut test);
15041504
// config
1505-
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff000100000000", &mut test);
1505+
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff00010000000000", &mut test);
15061506

15071507
// new outbound connection with id 0
15081508
ext_from_hex("00", &mut test);

lightning/src/util/config.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,20 @@ pub struct UserConfig {
943943
/// Default value: `false`
944944
#[cfg(test)]
945945
pub enable_htlc_hold: bool,
946+
/// If this is set to true, then if we as an often-offline payer receive a [`StaticInvoice`] to
947+
/// pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel
948+
/// counterparty(s) that support the `htlc_hold` feature. This allows our node to go offline once
949+
/// the HTLCs are locked in even though the recipient may not yet be online to receive them.
950+
///
951+
/// This option is intended for usage by private nodes, and should NOT be set if we are an
952+
/// announced node that is expected to be online at all times.
953+
///
954+
/// Setting this to `true` may lead to HTLC failures if downgrading to LDK versions < 0.2.
955+
///
956+
/// Default value: `false`
957+
///
958+
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
959+
pub hold_outbound_htlcs_at_next_hop: bool,
946960
}
947961

948962
impl Default for UserConfig {
@@ -959,6 +973,7 @@ impl Default for UserConfig {
959973
enable_dual_funded_channels: false,
960974
#[cfg(test)]
961975
enable_htlc_hold: false,
976+
hold_outbound_htlcs_at_next_hop: false,
962977
}
963978
}
964979
}
@@ -979,6 +994,7 @@ impl Readable for UserConfig {
979994
accept_intercept_htlcs: Readable::read(reader)?,
980995
manually_handle_bolt12_invoices: Readable::read(reader)?,
981996
enable_dual_funded_channels: Readable::read(reader)?,
997+
hold_outbound_htlcs_at_next_hop: Readable::read(reader)?,
982998
})
983999
}
9841000
}

0 commit comments

Comments
 (0)