Skip to content

Add NoopAdd HTLCs #9871

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

Merged
merged 7 commits into from
Aug 12, 2025
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
7 changes: 7 additions & 0 deletions docs/release-notes/release-notes-0.20.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@

# New Features

- Added [NoOp HTLCs](https://github.com/lightningnetwork/lnd/pull/9871). This
allows sending HTLCs to the remote party without shifting the balances of the
channel. This is currently only possible to use with custom channels, and only
when the appropriate TLV flag is set. This allows for HTLCs carrying metadata to
reflect their state on the channel commitment without having to send or receive
a certain amount of msats.

## Functional Enhancements

* RPCs `walletrpc.EstimateFee` and `walletrpc.FundPsbt` now
Expand Down
29 changes: 26 additions & 3 deletions lnwallet/aux_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@ import (
"github.com/lightningnetwork/lnd/tlv"
)

// htlcCustomSigType is the TLV type that is used to encode the custom HTLC
// signatures within the custom data for an existing HTLC.
var htlcCustomSigType tlv.TlvType65543
var (
// htlcCustomSigType is the TLV type that is used to encode the custom
// HTLC signatures within the custom data for an existing HTLC.
htlcCustomSigType tlv.TlvType65543

// NoOpHtlcTLVEntry is the TLV that that's used in the update_add_htlc
// message to indicate the presence of a noop HTLC. This has no encoded
// value, its presence is used to indicate that the HTLC is a noop.
NoOpHtlcTLVEntry tlv.TlvType65544
)

// NoOpHtlcTLVType is the (golang) type of the TLV record that's used to signal
// that an HTLC should be a noop HTLC.
type NoOpHtlcTLVType = tlv.TlvType65544

// AuxHtlcView is a struct that contains a safe copy of an HTLC view that can
// be used by aux components.
Expand Down Expand Up @@ -116,6 +127,18 @@ func (a *AuxHtlcDescriptor) AddHeight(
return a.addCommitHeightLocal
}

// IsAdd checks if the entry type of the Aux HTLC Descriptor is an add type.
func (a *AuxHtlcDescriptor) IsAdd() bool {
switch a.EntryType {
case Add:
fallthrough
case NoOpAdd:
return true
default:
return false
}
}

// RemoveHeight returns the height at which the HTLC was removed from the
// commitment chain. The height is returned based on the chain the HTLC is being
// removed from (local or remote chain).
Expand Down
Loading
Loading