Skip to content

Commit 9cc8fa4

Browse files
Roasbeefguggero
authored andcommitted
lnwallet: add custom tlv blob to internal commitment struct
In this commit, we also add the custom TLV blob to the internal commitment struct that we use within the in-memory commitment linked list. This'll be useful to ensure that we're tracking the current blob for our in memory commitment for when we need to write it to disk.
1 parent b68195a commit 9cc8fa4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lnwallet/channel.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
3333
"github.com/lightningnetwork/lnd/lnwire"
3434
"github.com/lightningnetwork/lnd/shachain"
35+
"github.com/lightningnetwork/lnd/tlv"
3536
)
3637

3738
var (
@@ -546,6 +547,10 @@ type commitment struct {
546547
// on this commitment transaction.
547548
incomingHTLCs []PaymentDescriptor
548549

550+
// customBlob stores opaque bytes that may be used by custom channels
551+
// to store extra data for a given commitment state.
552+
customBlob fn.Option[tlv.Blob]
553+
549554
// [outgoing|incoming]HTLCIndex is an index that maps an output index
550555
// on the commitment transaction to the payment descriptor that
551556
// represents the HTLC output.
@@ -726,6 +731,7 @@ func (c *commitment) toDiskCommit(ourCommit bool) *channeldb.ChannelCommitment {
726731
CommitTx: c.txn,
727732
CommitSig: c.sig,
728733
Htlcs: make([]channeldb.HTLC, 0, numHtlcs),
734+
CustomBlob: c.customBlob,
729735
}
730736

731737
for _, htlc := range c.outgoingHTLCs {

0 commit comments

Comments
 (0)