mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-02 11:09:38 +02:00
lnwallet: add whoseCommit to FetchLeavesFromCommit
This is useful for additional context to know which commit the AuxLeafStore is fetching the leaves for.
This commit is contained in:
parent
ba16a74491
commit
87b4991bb6
@ -436,6 +436,7 @@ func (c *chainWatcher) handleUnknownLocalState(
|
|||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
lnwallet.NewAuxChanState(c.cfg.chanState),
|
lnwallet.NewAuxChanState(c.cfg.chanState),
|
||||||
c.cfg.chanState.LocalCommitment, *commitKeyRing,
|
c.cfg.chanState.LocalCommitment, *commitKeyRing,
|
||||||
|
lntypes.Local,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
|
@ -178,7 +178,8 @@ type AuxLeafStore interface {
|
|||||||
// commitment.
|
// commitment.
|
||||||
FetchLeavesFromCommit(chanState AuxChanState,
|
FetchLeavesFromCommit(chanState AuxChanState,
|
||||||
commit channeldb.ChannelCommitment,
|
commit channeldb.ChannelCommitment,
|
||||||
keyRing CommitmentKeyRing) fn.Result[CommitDiffAuxResult]
|
keyRing CommitmentKeyRing, whoseCommit lntypes.ChannelParty,
|
||||||
|
) fn.Result[CommitDiffAuxResult]
|
||||||
|
|
||||||
// FetchLeavesFromRevocation attempts to fetch the auxiliary leaves
|
// FetchLeavesFromRevocation attempts to fetch the auxiliary leaves
|
||||||
// from a channel revocation that stores balance + blob information.
|
// from a channel revocation that stores balance + blob information.
|
||||||
|
@ -666,6 +666,7 @@ func (lc *LightningChannel) diskCommitToMemCommit(
|
|||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(lc.channelState), *diskCommit,
|
NewAuxChanState(lc.channelState), *diskCommit,
|
||||||
*commitKeys.GetForParty(whoseCommit),
|
*commitKeys.GetForParty(whoseCommit),
|
||||||
|
whoseCommit,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
@ -1834,7 +1835,7 @@ func (lc *LightningChannel) restorePendingLocalUpdates(
|
|||||||
func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(lc.channelState), pendingCommit,
|
NewAuxChanState(lc.channelState), pendingCommit,
|
||||||
*pendingRemoteKeys,
|
*pendingRemoteKeys, lntypes.Remote,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
@ -3154,7 +3155,7 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
|||||||
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState), *diskCommit,
|
NewAuxChanState(chanState), *diskCommit,
|
||||||
*keyRing,
|
*keyRing, lntypes.Remote,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
@ -4740,7 +4741,7 @@ func genHtlcSigValidationJobs(chanState *channeldb.OpenChannel,
|
|||||||
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState), *diskCommit,
|
NewAuxChanState(chanState), *diskCommit,
|
||||||
*keyRing,
|
*keyRing, lntypes.Local,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
@ -6727,7 +6728,7 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
|
|||||||
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState), remoteCommit,
|
NewAuxChanState(chanState), remoteCommit,
|
||||||
*keyRing,
|
*keyRing, lntypes.Remote,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
@ -7949,6 +7950,7 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
|
|||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState),
|
NewAuxChanState(chanState),
|
||||||
chanState.LocalCommitment, *keyRing,
|
chanState.LocalCommitment, *keyRing,
|
||||||
|
lntypes.Local,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
|
@ -1307,7 +1307,7 @@ func findOutputIndexesFromRemote(revocationPreimage *chainhash.Hash,
|
|||||||
leafStore, func(a AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
leafStore, func(a AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return a.FetchLeavesFromCommit(
|
return a.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState), chanCommit,
|
NewAuxChanState(chanState), chanCommit,
|
||||||
*keyRing,
|
*keyRing, lntypes.Remote,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/fn"
|
"github.com/lightningnetwork/lnd/fn"
|
||||||
|
"github.com/lightningnetwork/lnd/lntypes"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||||
"github.com/lightningnetwork/lnd/tlv"
|
"github.com/lightningnetwork/lnd/tlv"
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
@ -420,8 +421,8 @@ func (*MockAuxLeafStore) FetchLeavesFromView(
|
|||||||
// correspond to the passed aux blob, and an existing channel
|
// correspond to the passed aux blob, and an existing channel
|
||||||
// commitment.
|
// commitment.
|
||||||
func (*MockAuxLeafStore) FetchLeavesFromCommit(_ AuxChanState,
|
func (*MockAuxLeafStore) FetchLeavesFromCommit(_ AuxChanState,
|
||||||
_ channeldb.ChannelCommitment,
|
_ channeldb.ChannelCommitment, _ CommitmentKeyRing,
|
||||||
_ CommitmentKeyRing) fn.Result[CommitDiffAuxResult] {
|
_ lntypes.ChannelParty) fn.Result[CommitDiffAuxResult] {
|
||||||
|
|
||||||
return fn.Ok(CommitDiffAuxResult{})
|
return fn.Ok(CommitDiffAuxResult{})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user