@@ -2462,7 +2462,8 @@ type BreachRetribution struct {
24622462// required to construct the BreachRetribution. If the revocation log is missing
24632463// the required fields then ErrRevLogDataMissing will be returned.
24642464func NewBreachRetribution (chanState * channeldb.OpenChannel , stateNum uint64 ,
2465- breachHeight uint32 , spendTx * wire.MsgTx ) (* BreachRetribution , error ) {
2465+ breachHeight uint32 , spendTx * wire.MsgTx ,
2466+ leafStore fn.Option [AuxLeafStore ]) (* BreachRetribution , error ) {
24662467
24672468 // Query the on-disk revocation log for the snapshot which was recorded
24682469 // at this particular state num. Based on whether a legacy revocation
@@ -3493,9 +3494,16 @@ func processFeeUpdate(feeUpdate *PaymentDescriptor, nextHeight uint64,
34933494// signature can be submitted to the sigPool to generate all the signatures
34943495// asynchronously and in parallel.
34953496func genRemoteHtlcSigJobs (keyRing * CommitmentKeyRing ,
3496- chanType channeldb.ChannelType , isRemoteInitiator bool ,
3497- leaseExpiry uint32 , localChanCfg , remoteChanCfg * channeldb.ChannelConfig ,
3498- remoteCommitView * commitment ) ([]SignJob , chan struct {}, error ) {
3497+ chanState * channeldb.OpenChannel , leaseExpiry uint32 ,
3498+ remoteCommitView * commitment ,
3499+ leafStore fn.Option [AuxLeafStore ]) ([]SignJob , chan struct {}, error ) {
3500+
3501+ var (
3502+ isRemoteInitiator = ! chanState .IsInitiator
3503+ localChanCfg = chanState .LocalChanCfg
3504+ remoteChanCfg = chanState .RemoteChanCfg
3505+ chanType = chanState .ChanType
3506+ )
34993507
35003508 txHash := remoteCommitView .txn .TxHash ()
35013509 dustLimit := remoteChanCfg .DustLimit
@@ -3661,9 +3669,9 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
36613669// validate this new state. This function is called right before sending the
36623670// new commitment to the remote party. The commit diff returned contains all
36633671// information necessary for retransmission.
3664- func (lc * LightningChannel ) createCommitDiff (
3665- newCommit * commitment , commitSig lnwire.Sig ,
3666- htlcSigs []lnwire. Sig ) ( * channeldb. CommitDiff , error ) {
3672+ func (lc * LightningChannel ) createCommitDiff (newCommit * commitment ,
3673+ commitSig lnwire. Sig , htlcSigs [] lnwire.Sig ) ( * channeldb. CommitDiff ,
3674+ error ) {
36673675
36683676 // First, we need to convert the funding outpoint into the ID that's
36693677 // used on the wire to identify this channel. We'll use this shortly
@@ -4362,9 +4370,8 @@ func (lc *LightningChannel) SignNextCommitment() (*NewCommitState, error) {
43624370 leaseExpiry = lc .channelState .ThawHeight
43634371 }
43644372 sigBatch , cancelChan , err := genRemoteHtlcSigJobs (
4365- keyRing , lc .channelState .ChanType , ! lc .channelState .IsInitiator ,
4366- leaseExpiry , & lc .channelState .LocalChanCfg ,
4367- & lc .channelState .RemoteChanCfg , newCommitView ,
4373+ keyRing , lc .channelState , leaseExpiry , newCommitView ,
4374+ lc .leafStore ,
43684375 )
43694376 if err != nil {
43704377 return nil , err
@@ -4927,10 +4934,18 @@ func (lc *LightningChannel) computeView(view *HtlcView, remoteChain bool,
49274934// meant to verify all the signatures for HTLC's attached to a newly created
49284935// commitment state. The jobs generated are fully populated, and can be sent
49294936// directly into the pool of workers.
4930- func genHtlcSigValidationJobs (localCommitmentView * commitment ,
4931- keyRing * CommitmentKeyRing , htlcSigs []lnwire.Sig ,
4932- chanType channeldb.ChannelType , isLocalInitiator bool , leaseExpiry uint32 ,
4933- localChanCfg , remoteChanCfg * channeldb.ChannelConfig ) ([]VerifyJob , error ) {
4937+ //
4938+ //nolint:funlen
4939+ func genHtlcSigValidationJobs (chanState * channeldb.OpenChannel ,
4940+ localCommitmentView * commitment , keyRing * CommitmentKeyRing ,
4941+ htlcSigs []lnwire.Sig , leaseExpiry uint32 ,
4942+ leafStore fn.Option [AuxLeafStore ]) ([]VerifyJob , error ) {
4943+
4944+ var (
4945+ isLocalInitiator = chanState .IsInitiator
4946+ localChanCfg = chanState .LocalChanCfg
4947+ chanType = chanState .ChanType
4948+ )
49344949
49354950 txHash := localCommitmentView .txn .TxHash ()
49364951 feePerKw := localCommitmentView .feePerKw
@@ -5323,10 +5338,8 @@ func (lc *LightningChannel) ReceiveNewCommitment(commitSigs *CommitSigs) error {
53235338 leaseExpiry = lc .channelState .ThawHeight
53245339 }
53255340 verifyJobs , err := genHtlcSigValidationJobs (
5326- localCommitmentView , keyRing , commitSigs .HtlcSigs ,
5327- lc .channelState .ChanType , lc .channelState .IsInitiator ,
5328- leaseExpiry , & lc .channelState .LocalChanCfg ,
5329- & lc .channelState .RemoteChanCfg ,
5341+ lc .channelState , localCommitmentView , keyRing ,
5342+ commitSigs .HtlcSigs , leaseExpiry , lc .leafStore ,
53305343 )
53315344 if err != nil {
53325345 return err
@@ -6773,10 +6786,10 @@ type UnilateralCloseSummary struct {
67736786// happen in case we have lost state) it should be set to an empty struct, in
67746787// which case we will attempt to sweep the non-HTLC output using the passed
67756788// commitPoint.
6776- func NewUnilateralCloseSummary (chanState * channeldb.OpenChannel , signer input. Signer ,
6777- commitSpend * chainntnfs.SpendDetail ,
6778- remoteCommit channeldb.ChannelCommitment ,
6779- commitPoint * btcec. PublicKey ) (* UnilateralCloseSummary , error ) {
6789+ func NewUnilateralCloseSummary (chanState * channeldb.OpenChannel ,
6790+ signer input. Signer , commitSpend * chainntnfs.SpendDetail ,
6791+ remoteCommit channeldb.ChannelCommitment , commitPoint * btcec. PublicKey ,
6792+ leafStore fn. Option [ AuxLeafStore ] ) (* UnilateralCloseSummary , error ) {
67806793
67816794 // First, we'll generate the commitment point and the revocation point
67826795 // so we can re-construct the HTLC state and also our payment key.
@@ -7717,7 +7730,7 @@ func (lc *LightningChannel) ForceClose() (*LocalForceCloseSummary, error) {
77177730 localCommitment := lc .channelState .LocalCommitment
77187731 summary , err := NewLocalForceCloseSummary (
77197732 lc .channelState , lc .Signer , commitTx ,
7720- localCommitment .CommitHeight ,
7733+ localCommitment .CommitHeight , lc . leafStore ,
77217734 )
77227735 if err != nil {
77237736 return nil , fmt .Errorf ("unable to gen force close " +
@@ -7734,8 +7747,8 @@ func (lc *LightningChannel) ForceClose() (*LocalForceCloseSummary, error) {
77347747// channel state. The passed commitTx must be a fully signed commitment
77357748// transaction corresponding to localCommit.
77367749func NewLocalForceCloseSummary (chanState * channeldb.OpenChannel ,
7737- signer input.Signer , commitTx * wire.MsgTx , stateNum uint64 ) (
7738- * LocalForceCloseSummary , error ) {
7750+ signer input.Signer , commitTx * wire.MsgTx , stateNum uint64 ,
7751+ leafStore fn. Option [ AuxLeafStore ]) ( * LocalForceCloseSummary , error ) {
77397752
77407753 // Re-derive the original pkScript for to-self output within the
77417754 // commitment transaction. We'll need this to find the corresponding
0 commit comments