Skip to content

Commit 8810793

Browse files
authored
Merge pull request #9871 from GeorgeTsagk/htlc-noop-add
Add `NoopAdd` HTLCs
2 parents f3e1f2f + 97bbbf1 commit 8810793

File tree

5 files changed

+673
-48
lines changed

5 files changed

+673
-48
lines changed

docs/release-notes/release-notes-0.20.0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040

4141
# New Features
4242

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

4552
* RPCs `walletrpc.EstimateFee` and `walletrpc.FundPsbt` now

lnwallet/aux_signer.go

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@ import (
1010
"github.com/lightningnetwork/lnd/tlv"
1111
)
1212

13-
// htlcCustomSigType is the TLV type that is used to encode the custom HTLC
14-
// signatures within the custom data for an existing HTLC.
15-
var htlcCustomSigType tlv.TlvType65543
13+
var (
14+
// htlcCustomSigType is the TLV type that is used to encode the custom
15+
// HTLC signatures within the custom data for an existing HTLC.
16+
htlcCustomSigType tlv.TlvType65543
17+
18+
// NoOpHtlcTLVEntry is the TLV that that's used in the update_add_htlc
19+
// message to indicate the presence of a noop HTLC. This has no encoded
20+
// value, its presence is used to indicate that the HTLC is a noop.
21+
NoOpHtlcTLVEntry tlv.TlvType65544
22+
)
23+
24+
// NoOpHtlcTLVType is the (golang) type of the TLV record that's used to signal
25+
// that an HTLC should be a noop HTLC.
26+
type NoOpHtlcTLVType = tlv.TlvType65544
1627

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

130+
// IsAdd checks if the entry type of the Aux HTLC Descriptor is an add type.
131+
func (a *AuxHtlcDescriptor) IsAdd() bool {
132+
switch a.EntryType {
133+
case Add:
134+
fallthrough
135+
case NoOpAdd:
136+
return true
137+
default:
138+
return false
139+
}
140+
}
141+
119142
// RemoveHeight returns the height at which the HTLC was removed from the
120143
// commitment chain. The height is returned based on the chain the HTLC is being
121144
// removed from (local or remote chain).

0 commit comments

Comments
 (0)