Skip to content

Commit 20a12ae

Browse files
committed
Update docs for pending_update_fee and holding_cell_update_fee
The docs were left stale after the logic was updated in lightningdevkit#985 as pointed out in post-merge review.
1 parent a369f9e commit 20a12ae

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

lightning/src/ln/channel.rs

+10-14
Original file line numberDiff line numberDiff line change
@@ -424,22 +424,18 @@ pub(super) struct Channel<Signer: Sign> {
424424
monitor_pending_forwards: Vec<(PendingHTLCInfo, u64)>,
425425
monitor_pending_failures: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
426426

427-
// pending_update_fee is filled when sending and receiving update_fee
428-
// For outbound channel, feerate_per_kw is updated with the value from
429-
// pending_update_fee when revoke_and_ack is received
427+
// pending_update_fee is filled when sending and receiving update_fee.
430428
//
431-
// For inbound channel, feerate_per_kw is updated when it receives
432-
// commitment_signed and revoke_and_ack is generated
433-
// The pending value is kept when another pair of update_fee and commitment_signed
434-
// is received during AwaitingRemoteRevoke and relieved when the expected
435-
// revoke_and_ack is received and new commitment_signed is generated to be
436-
// sent to the funder. Otherwise, the pending value is removed when receiving
437-
// commitment_signed.
429+
// Because it follows the same commitment flow as HTLCs, `FeeUpdateState` is either `Outbound`
430+
// or matches a subset of the `InboundHTLCOutput` variants. It is then updated/used when
431+
// generating new commitment transactions with exactly the same criteria as inbound/outbound
432+
// HTLCs with similar state.
438433
pending_update_fee: Option<(u32, FeeUpdateState)>,
439-
// update_fee() during ChannelState::AwaitingRemoteRevoke is hold in
440-
// holdina_cell_update_fee then moved to pending_udpate_fee when revoke_and_ack
441-
// is received. holding_cell_update_fee is updated when there are additional
442-
// update_fee() during ChannelState::AwaitingRemoteRevoke.
434+
// If an update_fee() call is made with ChannelState::AwaitingRemoteRevoke set, we place it
435+
// here instead of `pending_update_fee` in the same way as we place outbound HTLC updates in
436+
// `holding_cell_htlc_updates` instead of `pending_outbound_htlcs`. It is released into
437+
// `pending_update_fee` with the same criteria as outbound HTLC updates but can be updated by
438+
// further `update_fee` calls, dropping the previous holding cell update entirely.
443439
holding_cell_update_fee: Option<u32>,
444440
next_holder_htlc_id: u64,
445441
next_counterparty_htlc_id: u64,

0 commit comments

Comments
 (0)