lnwallet: add field CommitTxBlockHeight to ResolutionReq

Introduce `CommitTxBlockHeight` field to the `ResolutionReq` structure
and related methods. This field records the block height where a
commitment transaction has confirmed.
This commit is contained in:
ffranr committed 2025-11-25 17:06:18 +00:00
1 parent b9ea7070c2
commit 3d2b0d703e
3 files changed
+177 -150

No files matched your search

+2 -1
View File
@@ -1061,7 +1061,8 @@ func (c *chainWatcher) dispatchLocalForceClose(
"detected", c.cfg.chanState.FundingOutpoint) "detected", c.cfg.chanState.FundingOutpoint)
forceClose, err := lnwallet.NewLocalForceCloseSummary( forceClose, err := lnwallet.NewLocalForceCloseSummary(
c.cfg.chanState, c.cfg.signer, commitSpend.SpendingTx, stateNum, c.cfg.chanState, c.cfg.signer, commitSpend.SpendingTx,
uint32(commitSpend.SpendingHeight), stateNum,
c.cfg.auxLeafStore, c.cfg.auxResolver, c.cfg.auxLeafStore, c.cfg.auxResolver,
) )
if err != nil { if err != nil {
+4
View File
@@ -77,6 +77,10 @@ type ResolutionReq struct {
// CommitTx is the force close commitment transaction. // CommitTx is the force close commitment transaction.
CommitTx *wire.MsgTx CommitTx *wire.MsgTx
// CommitTxBlockHeight is the block height where the commitment
// transaction confirmed. It is 0 if unknown or not confirmed yet.
CommitTxBlockHeight uint32
// CommitFee is the fee that was paid for the commitment transaction. // CommitFee is the fee that was paid for the commitment transaction.
CommitFee btcutil.Amount CommitFee btcutil.Amount
+171 -149
View File
@@ -2215,20 +2215,23 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
// At this point, we'll check to see if we need any extra // At this point, we'll check to see if we need any extra
// resolution data for this output. // resolution data for this output.
//
//nolint:ll
resolveReq := ResolutionReq{ resolveReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanState.ChanType, ChanType: chanState.ChanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
Type: input.TaprootRemoteCommitSpend, Type: input.TaprootRemoteCommitSpend,
CloseType: Breach, CloseType: Breach,
CommitTx: spendTx, CommitTx: spendTx,
SignDesc: *br.LocalOutputSignDesc, CommitTxBlockHeight: breachHeight,
KeyRing: keyRing, SignDesc: *br.LocalOutputSignDesc,
CsvDelay: ourDelay, KeyRing: keyRing,
BreachCsvDelay: fn.Some(theirDelay), CsvDelay: ourDelay,
CommitFee: chanState.RemoteCommitment.CommitFee, BreachCsvDelay: fn.Some(theirDelay),
CommitFee: chanState.RemoteCommitment.CommitFee,
} }
if revokedLog != nil { if revokedLog != nil {
resolveReq.CommitBlob = revokedLog.CustomBlob.ValOpt() resolveReq.CommitBlob = revokedLog.CustomBlob.ValOpt()
@@ -2295,20 +2298,23 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
// At this point, we'll check to see if we need any extra // At this point, we'll check to see if we need any extra
// resolution data for this output. // resolution data for this output.
//
//nolint:ll
resolveReq := ResolutionReq{ resolveReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanState.ChanType, ChanType: chanState.ChanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
Type: input.TaprootCommitmentRevoke, Type: input.TaprootCommitmentRevoke,
CloseType: Breach, CloseType: Breach,
CommitTx: spendTx, CommitTx: spendTx,
SignDesc: *br.RemoteOutputSignDesc, CommitTxBlockHeight: breachHeight,
KeyRing: keyRing, SignDesc: *br.RemoteOutputSignDesc,
CsvDelay: theirDelay, KeyRing: keyRing,
BreachCsvDelay: fn.Some(theirDelay), CsvDelay: theirDelay,
CommitFee: chanState.RemoteCommitment.CommitFee, BreachCsvDelay: fn.Some(theirDelay),
CommitFee: chanState.RemoteCommitment.CommitFee,
} }
if revokedLog != nil { if revokedLog != nil {
resolveReq.CommitBlob = revokedLog.CustomBlob.ValOpt() resolveReq.CommitBlob = revokedLog.CustomBlob.ValOpt()
@@ -6886,6 +6892,7 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
// First, we'll generate the commitment point and the revocation point // First, we'll generate the commitment point and the revocation point
// so we can re-construct the HTLC state and also our payment key. // so we can re-construct the HTLC state and also our payment key.
commitType := lntypes.Remote commitType := lntypes.Remote
commitTxHeight := uint32(commitSpend.SpendingHeight)
keyRing := DeriveCommitmentKeys( keyRing := DeriveCommitmentKeys(
commitPoint, commitType, chanState.ChanType, commitPoint, commitType, chanState.ChanType,
&chanState.LocalChanCfg, &chanState.RemoteChanCfg, &chanState.LocalChanCfg, &chanState.RemoteChanCfg,
@@ -6920,8 +6927,9 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
chainfee.SatPerKWeight(remoteCommit.FeePerKw), commitType, chainfee.SatPerKWeight(remoteCommit.FeePerKw), commitType,
signer, remoteCommit.Htlcs, keyRing, &chanState.LocalChanCfg, signer, remoteCommit.Htlcs, keyRing, &chanState.LocalChanCfg,
&chanState.RemoteChanCfg, commitSpend.SpendingTx, &chanState.RemoteChanCfg, commitSpend.SpendingTx,
chanState.ChanType, isRemoteInitiator, leaseExpiry, chanState, commitTxHeight, chanState.ChanType,
auxResult.AuxLeaves, auxResolver, isRemoteInitiator, leaseExpiry, chanState, auxResult.AuxLeaves,
auxResolver,
) )
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to create htlc resolutions: %w", return nil, fmt.Errorf("unable to create htlc resolutions: %w",
@@ -7009,21 +7017,24 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
// At this point, we'll check to see if we need any extra // At this point, we'll check to see if we need any extra
// resolution data for this output. // resolution data for this output.
//
//nolint:ll
resolveReq := ResolutionReq{ resolveReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanState.ChanType, ChanType: chanState.ChanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
CommitBlob: chanState.RemoteCommitment.CustomBlob, CommitBlob: chanState.RemoteCommitment.CustomBlob,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
Type: input.TaprootRemoteCommitSpend, Type: input.TaprootRemoteCommitSpend,
CloseType: RemoteForceClose, CloseType: RemoteForceClose,
CommitTx: commitTxBroadcast, CommitTx: commitTxBroadcast,
ContractPoint: *selfPoint, CommitTxBlockHeight: commitTxHeight,
SignDesc: commitResolution.SelfOutputSignDesc, ContractPoint: *selfPoint,
KeyRing: keyRing, SignDesc: commitResolution.SelfOutputSignDesc,
CsvDelay: maturityDelay, KeyRing: keyRing,
CommitFee: chanState.RemoteCommitment.CommitFee, CsvDelay: maturityDelay,
CommitFee: chanState.RemoteCommitment.CommitFee,
} }
resolveBlob := fn.MapOptionZ( resolveBlob := fn.MapOptionZ(
auxResolver, auxResolver,
@@ -7209,7 +7220,7 @@ type HtlcResolutions struct {
// the remote party's commitment transaction. // the remote party's commitment transaction.
func newOutgoingHtlcResolution(signer input.Signer, func newOutgoingHtlcResolution(signer input.Signer,
localChanCfg *channeldb.ChannelConfig, commitTx *wire.MsgTx, localChanCfg *channeldb.ChannelConfig, commitTx *wire.MsgTx,
htlc *channeldb.HTLC, keyRing *CommitmentKeyRing, commitTxHeight uint32, htlc *channeldb.HTLC, keyRing *CommitmentKeyRing,
feePerKw chainfee.SatPerKWeight, csvDelay, leaseExpiry uint32, feePerKw chainfee.SatPerKWeight, csvDelay, leaseExpiry uint32,
whoseCommit lntypes.ChannelParty, isCommitFromInitiator bool, whoseCommit lntypes.ChannelParty, isCommitFromInitiator bool,
chanType channeldb.ChannelType, chanState *channeldb.OpenChannel, chanType channeldb.ChannelType, chanState *channeldb.OpenChannel,
@@ -7285,24 +7296,26 @@ func newOutgoingHtlcResolution(signer input.Signer,
} }
} }
//nolint:ll
resReq := ResolutionReq{ resReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanType, ChanType: chanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
CommitBlob: chanState.RemoteCommitment.CustomBlob, CommitBlob: chanState.RemoteCommitment.CustomBlob,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
Type: input.TaprootHtlcOfferedRemoteTimeout, Type: input.TaprootHtlcOfferedRemoteTimeout,
CloseType: RemoteForceClose, CloseType: RemoteForceClose,
CommitTx: commitTx, CommitTx: commitTx,
ContractPoint: op, CommitTxBlockHeight: commitTxHeight,
SignDesc: signDesc, ContractPoint: op,
KeyRing: keyRing, SignDesc: signDesc,
CsvDelay: htlcCsvDelay, KeyRing: keyRing,
CltvDelay: fn.Some(htlc.RefundTimeout), CsvDelay: htlcCsvDelay,
CommitFee: chanState.RemoteCommitment.CommitFee, CltvDelay: fn.Some(htlc.RefundTimeout),
HtlcID: fn.Some(htlc.HtlcIndex), CommitFee: chanState.RemoteCommitment.CommitFee,
PayHash: fn.Some(htlc.RHash), HtlcID: fn.Some(htlc.HtlcIndex),
PayHash: fn.Some(htlc.RHash),
} }
resolveRes := fn.MapOptionZ( resolveRes := fn.MapOptionZ(
auxResolver, auxResolver,
@@ -7513,31 +7526,33 @@ func newOutgoingHtlcResolution(signer input.Signer,
// the sweeping sub-system. // the sweeping sub-system.
resolveRes := fn.MapOptionZ( resolveRes := fn.MapOptionZ(
auxResolver, func(a AuxContractResolver) fn.Result[tlv.Blob] { auxResolver, func(a AuxContractResolver) fn.Result[tlv.Blob] {
//nolint:ll
resReq := ResolutionReq{ resReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanType, ChanType: chanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
CommitBlob: chanState.LocalCommitment.CustomBlob, //nolint:ll CommitBlob: chanState.LocalCommitment.CustomBlob,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
Type: input.TaprootHtlcLocalOfferedTimeout, //nolint:ll Type: input.TaprootHtlcLocalOfferedTimeout,
CloseType: LocalForceClose, CloseType: LocalForceClose,
CommitTx: commitTx, CommitTx: commitTx,
ContractPoint: op, CommitTxBlockHeight: commitTxHeight,
SignDesc: sweepSignDesc, ContractPoint: op,
KeyRing: keyRing, SignDesc: sweepSignDesc,
CsvDelay: htlcCsvDelay, KeyRing: keyRing,
HtlcAmt: btcutil.Amount(txOut.Value), CsvDelay: htlcCsvDelay,
CommitCsvDelay: csvDelay, HtlcAmt: btcutil.Amount(txOut.Value),
CltvDelay: fn.Some(htlc.RefundTimeout), CommitCsvDelay: csvDelay,
CommitFee: chanState.LocalCommitment.CommitFee, //nolint:ll CltvDelay: fn.Some(htlc.RefundTimeout),
HtlcID: fn.Some(htlc.HtlcIndex), CommitFee: chanState.LocalCommitment.CommitFee,
PayHash: fn.Some(htlc.RHash), HtlcID: fn.Some(htlc.HtlcIndex),
PayHash: fn.Some(htlc.RHash),
AuxSigDesc: fn.Some(AuxSigDesc{ AuxSigDesc: fn.Some(AuxSigDesc{
SignDetails: *txSignDetails, SignDetails: *txSignDetails,
AuxSig: func() []byte { AuxSig: func() []byte {
tlvType := htlcCustomSigType.TypeVal() //nolint:ll tlvType := htlcCustomSigType.TypeVal()
return htlc.CustomRecords[uint64(tlvType)] //nolint:ll return htlc.CustomRecords[uint64(tlvType)]
}(), }(),
}), }),
} }
@@ -7573,7 +7588,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
// TODO(roasbeef) consolidate code with above func // TODO(roasbeef) consolidate code with above func
func newIncomingHtlcResolution(signer input.Signer, func newIncomingHtlcResolution(signer input.Signer,
localChanCfg *channeldb.ChannelConfig, commitTx *wire.MsgTx, localChanCfg *channeldb.ChannelConfig, commitTx *wire.MsgTx,
htlc *channeldb.HTLC, keyRing *CommitmentKeyRing, commitTxHeight uint32, htlc *channeldb.HTLC, keyRing *CommitmentKeyRing,
feePerKw chainfee.SatPerKWeight, csvDelay, leaseExpiry uint32, feePerKw chainfee.SatPerKWeight, csvDelay, leaseExpiry uint32,
whoseCommit lntypes.ChannelParty, isCommitFromInitiator bool, whoseCommit lntypes.ChannelParty, isCommitFromInitiator bool,
chanType channeldb.ChannelType, chanState *channeldb.OpenChannel, chanType channeldb.ChannelType, chanState *channeldb.OpenChannel,
@@ -7648,26 +7663,28 @@ func newIncomingHtlcResolution(signer input.Signer,
} }
} }
//nolint:ll
resReq := ResolutionReq{ resReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanType, ChanType: chanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
CommitBlob: chanState.RemoteCommitment.CustomBlob, CommitBlob: chanState.RemoteCommitment.CustomBlob,
Type: input.TaprootHtlcAcceptedRemoteSuccess, Type: input.TaprootHtlcAcceptedRemoteSuccess,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
CloseType: RemoteForceClose, CloseType: RemoteForceClose,
CommitTx: commitTx, CommitTx: commitTx,
ContractPoint: op, CommitTxBlockHeight: commitTxHeight,
SignDesc: signDesc, ContractPoint: op,
KeyRing: keyRing, SignDesc: signDesc,
HtlcID: fn.Some(htlc.HtlcIndex), KeyRing: keyRing,
CsvDelay: htlcCsvDelay, HtlcID: fn.Some(htlc.HtlcIndex),
CltvDelay: fn.Some(htlc.RefundTimeout), CsvDelay: htlcCsvDelay,
CommitFee: chanState.RemoteCommitment.CommitFee, CltvDelay: fn.Some(htlc.RefundTimeout),
PayHash: fn.Some(htlc.RHash), CommitFee: chanState.RemoteCommitment.CommitFee,
CommitCsvDelay: csvDelay, PayHash: fn.Some(htlc.RHash),
HtlcAmt: htlc.Amt.ToSatoshis(), CommitCsvDelay: csvDelay,
HtlcAmt: htlc.Amt.ToSatoshis(),
} }
resolveRes := fn.MapOptionZ( resolveRes := fn.MapOptionZ(
auxResolver, auxResolver,
@@ -7867,28 +7884,30 @@ func newIncomingHtlcResolution(signer input.Signer,
resolveRes := fn.MapOptionZ( resolveRes := fn.MapOptionZ(
auxResolver, func(a AuxContractResolver) fn.Result[tlv.Blob] { auxResolver, func(a AuxContractResolver) fn.Result[tlv.Blob] {
//nolint:ll
resReq := ResolutionReq{ resReq := ResolutionReq{
ChanPoint: chanState.FundingOutpoint, ChanPoint: chanState.FundingOutpoint,
ChanType: chanType, ChanType: chanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
CommitBlob: chanState.LocalCommitment.CustomBlob, //nolint:ll CommitBlob: chanState.LocalCommitment.CustomBlob,
Type: input.TaprootHtlcAcceptedLocalSuccess, //nolint:ll Type: input.TaprootHtlcAcceptedLocalSuccess,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
CloseType: LocalForceClose, CloseType: LocalForceClose,
CommitTx: commitTx, CommitTx: commitTx,
ContractPoint: op, CommitTxBlockHeight: commitTxHeight,
SignDesc: sweepSignDesc, ContractPoint: op,
KeyRing: keyRing, SignDesc: sweepSignDesc,
HtlcID: fn.Some(htlc.HtlcIndex), KeyRing: keyRing,
CsvDelay: htlcCsvDelay, HtlcID: fn.Some(htlc.HtlcIndex),
CommitFee: chanState.LocalCommitment.CommitFee, //nolint:ll CsvDelay: htlcCsvDelay,
PayHash: fn.Some(htlc.RHash), CommitFee: chanState.LocalCommitment.CommitFee,
PayHash: fn.Some(htlc.RHash),
AuxSigDesc: fn.Some(AuxSigDesc{ AuxSigDesc: fn.Some(AuxSigDesc{
SignDetails: *txSignDetails, SignDetails: *txSignDetails,
AuxSig: func() []byte { AuxSig: func() []byte {
tlvType := htlcCustomSigType.TypeVal() //nolint:ll tlvType := htlcCustomSigType.TypeVal()
return htlc.CustomRecords[uint64(tlvType)] //nolint:ll return htlc.CustomRecords[uint64(tlvType)]
}(), }(),
}), }),
CommitCsvDelay: csvDelay, CommitCsvDelay: csvDelay,
@@ -7949,9 +7968,10 @@ func extractHtlcResolutions(feePerKw chainfee.SatPerKWeight,
whoseCommit lntypes.ChannelParty, signer input.Signer, whoseCommit lntypes.ChannelParty, signer input.Signer,
htlcs []channeldb.HTLC, keyRing *CommitmentKeyRing, htlcs []channeldb.HTLC, keyRing *CommitmentKeyRing,
localChanCfg, remoteChanCfg *channeldb.ChannelConfig, localChanCfg, remoteChanCfg *channeldb.ChannelConfig,
commitTx *wire.MsgTx, chanType channeldb.ChannelType, commitTx *wire.MsgTx, commitTxHeight uint32,
isCommitFromInitiator bool, leaseExpiry uint32, chanType channeldb.ChannelType, isCommitFromInitiator bool,
chanState *channeldb.OpenChannel, auxLeaves fn.Option[CommitAuxLeaves], leaseExpiry uint32, chanState *channeldb.OpenChannel,
auxLeaves fn.Option[CommitAuxLeaves],
auxResolver fn.Option[AuxContractResolver]) (*HtlcResolutions, error) { auxResolver fn.Option[AuxContractResolver]) (*HtlcResolutions, error) {
// TODO(roasbeef): don't need to swap csv delay? // TODO(roasbeef): don't need to swap csv delay?
@@ -7984,8 +8004,8 @@ func extractHtlcResolutions(feePerKw chainfee.SatPerKWeight,
// Otherwise, we'll create an incoming HTLC resolution // Otherwise, we'll create an incoming HTLC resolution
// as we can satisfy the contract. // as we can satisfy the contract.
ihr, err := newIncomingHtlcResolution( ihr, err := newIncomingHtlcResolution(
signer, localChanCfg, commitTx, &htlc, signer, localChanCfg, commitTx, commitTxHeight,
keyRing, feePerKw, uint32(csvDelay), &htlc, keyRing, feePerKw, uint32(csvDelay),
leaseExpiry, whoseCommit, isCommitFromInitiator, leaseExpiry, whoseCommit, isCommitFromInitiator,
chanType, chanState, auxLeaves, auxResolver, chanType, chanState, auxLeaves, auxResolver,
) )
@@ -7999,10 +8019,10 @@ func extractHtlcResolutions(feePerKw chainfee.SatPerKWeight,
} }
ohr, err := newOutgoingHtlcResolution( ohr, err := newOutgoingHtlcResolution(
signer, localChanCfg, commitTx, &htlc, keyRing, signer, localChanCfg, commitTx, commitTxHeight, &htlc,
feePerKw, uint32(csvDelay), leaseExpiry, whoseCommit, keyRing, feePerKw, uint32(csvDelay), leaseExpiry,
isCommitFromInitiator, chanType, chanState, auxLeaves, whoseCommit, isCommitFromInitiator, chanType, chanState,
auxResolver, auxLeaves, auxResolver,
) )
if err != nil { if err != nil {
return nil, fmt.Errorf("outgoing resolution "+ return nil, fmt.Errorf("outgoing resolution "+
@@ -8148,7 +8168,8 @@ func (lc *LightningChannel) ForceClose(opts ...ForceCloseOpt) (
localCommitment := lc.channelState.LocalCommitment localCommitment := lc.channelState.LocalCommitment
summary, err := NewLocalForceCloseSummary( summary, err := NewLocalForceCloseSummary(
lc.channelState, lc.Signer, commitTx, lc.channelState, lc.Signer, commitTx,
localCommitment.CommitHeight, lc.leafStore, lc.auxResolver, 0, localCommitment.CommitHeight, lc.leafStore,
lc.auxResolver,
) )
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to gen force close "+ return nil, fmt.Errorf("unable to gen force close "+
@@ -8162,11 +8183,11 @@ func (lc *LightningChannel) ForceClose(opts ...ForceCloseOpt) (
} }
// NewLocalForceCloseSummary generates a LocalForceCloseSummary from the given // NewLocalForceCloseSummary generates a LocalForceCloseSummary from the given
// channel state. The passed commitTx must be a fully signed commitment // channel state. The passed commitTx must be a fully signed commitment
// transaction corresponding to localCommit. // transaction corresponding to localCommit.
func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel, func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
signer input.Signer, commitTx *wire.MsgTx, stateNum uint64, signer input.Signer, commitTx *wire.MsgTx, commitTxHeight uint32,
leafStore fn.Option[AuxLeafStore], stateNum uint64, leafStore fn.Option[AuxLeafStore],
auxResolver fn.Option[AuxContractResolver]) (*LocalForceCloseSummary, auxResolver fn.Option[AuxContractResolver]) (*LocalForceCloseSummary,
error) { error) {
@@ -8301,20 +8322,21 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
func(a AuxContractResolver) fn.Result[tlv.Blob] { func(a AuxContractResolver) fn.Result[tlv.Blob] {
//nolint:ll //nolint:ll
return a.ResolveContract(ResolutionReq{ return a.ResolveContract(ResolutionReq{
ChanPoint: chanState.FundingOutpoint, //nolint:ll ChanPoint: chanState.FundingOutpoint,
ChanType: chanState.ChanType, ChanType: chanState.ChanType,
ShortChanID: chanState.ShortChanID(), ShortChanID: chanState.ShortChanID(),
Initiator: chanState.IsInitiator, Initiator: chanState.IsInitiator,
CommitBlob: chanState.LocalCommitment.CustomBlob, CommitBlob: chanState.LocalCommitment.CustomBlob,
FundingBlob: chanState.CustomBlob, FundingBlob: chanState.CustomBlob,
Type: input.TaprootLocalCommitSpend, Type: input.TaprootLocalCommitSpend,
CloseType: LocalForceClose, CloseType: LocalForceClose,
CommitTx: commitTx, CommitTx: commitTx,
ContractPoint: commitResolution.SelfOutPoint, CommitTxBlockHeight: commitTxHeight,
SignDesc: commitResolution.SelfOutputSignDesc, ContractPoint: commitResolution.SelfOutPoint,
KeyRing: keyRing, SignDesc: commitResolution.SelfOutputSignDesc,
CsvDelay: csvTimeout, KeyRing: keyRing,
CommitFee: chanState.LocalCommitment.CommitFee, CsvDelay: csvTimeout,
CommitFee: chanState.LocalCommitment.CommitFee,
}) })
}, },
) )
@@ -8334,9 +8356,9 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
htlcResolutions, err := extractHtlcResolutions( htlcResolutions, err := extractHtlcResolutions(
chainfee.SatPerKWeight(localCommit.FeePerKw), lntypes.Local, chainfee.SatPerKWeight(localCommit.FeePerKw), lntypes.Local,
signer, localCommit.Htlcs, keyRing, &chanState.LocalChanCfg, signer, localCommit.Htlcs, keyRing, &chanState.LocalChanCfg,
&chanState.RemoteChanCfg, commitTx, chanState.ChanType, &chanState.RemoteChanCfg, commitTx, commitTxHeight,
chanState.IsInitiator, leaseExpiry, chanState, chanState.ChanType, chanState.IsInitiator, leaseExpiry,
auxResult.AuxLeaves, auxResolver, chanState, auxResult.AuxLeaves, auxResolver,
) )
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to gen htlc resolution: %w", err) return nil, fmt.Errorf("unable to gen htlc resolution: %w", err)