Skip to content

Commit

Permalink
Add further comments around fee update handling in channel
Browse files Browse the repository at this point in the history
These were suggested to clarify behavior in post-merge review of lightningdevkit#985.
  • Loading branch information
TheBlueMatt committed Aug 16, 2021
1 parent 20a12ae commit dd3097c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3705,6 +3705,8 @@ impl<Signer: Sign> Channel<Signer> {
// more dust balance if the feerate increases when we have several HTLCs pending
// which are near the dust limit.
let mut feerate_per_kw = self.feerate_per_kw;
// If there's a pending update fee, use it to ensure we aren't under-estimating
// potential feerate updates coming soon.
if let Some((feerate, _)) = self.pending_update_fee {
feerate_per_kw = cmp::max(feerate_per_kw, feerate);
}
Expand Down Expand Up @@ -4941,9 +4943,10 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
if self.is_outbound() {
self.pending_update_fee.map(|(a, _)| a).write(writer)?;
} else if let Some((feerate, FeeUpdateState::AwaitingRemoteRevokeToAnnounce)) = self.pending_update_fee {
// As for inbound HTLCs, if the update was only announced and never committed, drop it.
Some(feerate).write(writer)?;
} else {
// As for inbound HTLCs, if the update was only announced and never committed in a
// commitment_signed, drop it.
None::<u32>.write(writer)?;
}
self.holding_cell_update_fee.write(writer)?;
Expand Down

0 comments on commit dd3097c

Please sign in to comment.