Skip to content

Commit 79069b3

Browse files
f Jeff feedback
1 parent d3794ea commit 79069b3

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,10 +1819,9 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
18191819
} else { false }
18201820
}
18211821

1822-
// Fail a list of HTLCs. Only called when 1 or more HTLCs fails to be freed
1823-
// from the holding cell. In this case, the HTLCs need to be failed
1824-
// backwards or, if they were one of our outgoing HTLCs, then their failure
1825-
// needs to be surfaced to the user.
1822+
// Fail a list of HTLCs that were just freed from the holding cell. The HTLCs need to be
1823+
// failed backwards or, if they were one of our outgoing HTLCs, then their failure needs to
1824+
// be surfaced to the user.
18261825
fn fail_holding_cell_htlcs(&self, mut htlcs_to_fail: Vec<(HTLCSource, PaymentHash)>, channel_id: [u8; 32]) -> Result<(), MsgHandleErrInternal> {
18271826
for (htlc_src, payment_hash) in htlcs_to_fail.drain(..) {
18281827
match htlc_src {

lightning/src/ln/functional_tests.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6384,8 +6384,12 @@ fn bolt2_open_channel_sending_node_checks_part2() {
63846384
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.delayed_payment_basepoint.serialize()).is_ok());
63856385
}
63866386

6387+
// Test that if we fail to send an HTLC that is being freed from the holding cell, and the HTLC
6388+
// originated from our node, its failure is surfaced to the user. We trigger this failure to
6389+
// free the HTLC by increasing our fee while the HTLC is in the holding cell such that the HTLC
6390+
// is no longer affordable once it's freed.
63876391
#[test]
6388-
fn test_holding_cell_htlc_with_pending_fee_update() {
6392+
fn test_fail_holding_cell_htlc_upon_free() {
63896393
let chanmon_cfgs = create_chanmon_cfgs(2);
63906394
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
63916395
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
@@ -6454,8 +6458,12 @@ fn test_holding_cell_htlc_with_pending_fee_update() {
64546458
}
64556459
}
64566460

6461+
// Test that if we fail to forward an HTLC that is being freed from the holding cell that the
6462+
// HTLC is failed backwards. We trigger this failure to forward the freed HTLC by increasing
6463+
// our fee while the HTLC is in the holding cell such that the HTLC is no longer affordable
6464+
// once it's freed.
64576465
#[test]
6458-
fn test_holding_cell_htlc_with_pending_fee_update_multihop() {
6466+
fn test_fail_holding_cell_htlc_upon_free_multihop() {
64596467
let chanmon_cfgs = create_chanmon_cfgs(3);
64606468
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
64616469
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);

0 commit comments

Comments
 (0)