mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
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.
This commit is contained in:
parent
12352d9e6e
commit
d25f881433
@ -33,6 +33,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/shachain"
|
"github.com/lightningnetwork/lnd/shachain"
|
||||||
|
"github.com/lightningnetwork/lnd/tlv"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -333,6 +334,10 @@ type commitment struct {
|
|||||||
// on this commitment transaction.
|
// on this commitment transaction.
|
||||||
incomingHTLCs []PaymentDescriptor
|
incomingHTLCs []PaymentDescriptor
|
||||||
|
|
||||||
|
// customBlob stores opaque bytes that may be used by custom channels
|
||||||
|
// to store extra data for a given commitment state.
|
||||||
|
customBlob fn.Option[tlv.Blob]
|
||||||
|
|
||||||
// [outgoing|incoming]HTLCIndex is an index that maps an output index
|
// [outgoing|incoming]HTLCIndex is an index that maps an output index
|
||||||
// on the commitment transaction to the payment descriptor that
|
// on the commitment transaction to the payment descriptor that
|
||||||
// represents the HTLC output.
|
// represents the HTLC output.
|
||||||
@ -506,6 +511,7 @@ func (c *commitment) toDiskCommit(
|
|||||||
CommitTx: c.txn,
|
CommitTx: c.txn,
|
||||||
CommitSig: c.sig,
|
CommitSig: c.sig,
|
||||||
Htlcs: make([]channeldb.HTLC, 0, numHtlcs),
|
Htlcs: make([]channeldb.HTLC, 0, numHtlcs),
|
||||||
|
CustomBlob: c.customBlob,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, htlc := range c.outgoingHTLCs {
|
for _, htlc := range c.outgoingHTLCs {
|
||||||
@ -753,6 +759,7 @@ func (lc *LightningChannel) diskCommitToMemCommit(
|
|||||||
feePerKw: chainfee.SatPerKWeight(diskCommit.FeePerKw),
|
feePerKw: chainfee.SatPerKWeight(diskCommit.FeePerKw),
|
||||||
incomingHTLCs: incomingHtlcs,
|
incomingHTLCs: incomingHtlcs,
|
||||||
outgoingHTLCs: outgoingHtlcs,
|
outgoingHTLCs: outgoingHtlcs,
|
||||||
|
customBlob: diskCommit.CustomBlob,
|
||||||
}
|
}
|
||||||
if whoseCommit.IsLocal() {
|
if whoseCommit.IsLocal() {
|
||||||
commit.dustLimit = lc.channelState.LocalChanCfg.DustLimit
|
commit.dustLimit = lc.channelState.LocalChanCfg.DustLimit
|
||||||
|
Loading…
Reference in New Issue
Block a user