Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lnwallet: Introduce a fee buffer. #8096

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/release-notes/release-notes-0.18.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@
these unconfirmed transactions are already removed. In addition a new
walletrpc endpoint `RemoveTransaction` is introduced which let one easily
remove unconfirmed transaction manually.

* [Fixed](https://github.com/lightningnetwork/lnd/pull/8096) a case where `lnd`
might dip below its channel reserve when htlcs are added concurrently. A
fee buffer (additional balance) is now always kept on the local side ONLY
if the channel was opened locally. This is in accordance with the BOTL 02
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo

specification and protects against sharp fee changes because there is always
this buffer which can be used to increase the commitment fee and it also
protects against the case where htlcs are added asynchronously resulting in
stuck channels.

# New Features
## Functional Enhancements
Expand Down Expand Up @@ -223,3 +232,4 @@
* Turtle
* Ononiwu Maureen Chiamaka
* Yong Yu
* Ziggie
5 changes: 5 additions & 0 deletions htlcswitch/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,11 @@ func (l *channelLink) handleDownstreamUpdateAdd(pkt *htlcPacket) error {
// commitment chains.
htlc.ChanID = l.ChanID()
openCircuitRef := pkt.inKey()

// We enforce the fee buffer for the commitment transaction because
ziggie1984 marked this conversation as resolved.
Show resolved Hide resolved
// we are in control of adding this htlc. Nothing has locked-in yet so
// we can securely enforce the fee buffer which is only relevant if we
// are the initiator of the channel.
index, err := l.channel.AddHTLC(htlc, &openCircuitRef)
if err != nil {
// The HTLC was unable to be added to the state machine,
Expand Down
Loading
Loading