@@ -94,10 +94,6 @@ func (s *AuxLeafSigner) Stop() error {
9494 return stopErr
9595}
9696
97- // A compile-time check to ensure that AuxLeafSigner fully implements the
98- // lnwallet.AuxSigner interface.
99- var _ lnwallet.AuxSigner = (* AuxLeafSigner )(nil )
100-
10197// SubmitSecondLevelSigBatch takes a batch of aux sign jobs and processes them
10298// asynchronously.
10399func (s * AuxLeafSigner ) SubmitSecondLevelSigBatch (
@@ -112,9 +108,7 @@ func (s *AuxLeafSigner) SubmitSecondLevelSigBatch(
112108
113109// PackSigs takes a series of aux signatures and packs them into a single blob
114110// that can be sent alongside the CommitSig messages.
115- func (s * AuxLeafSigner ) PackSigs (
116- sigBlob []lfn.Option [tlv.Blob ]) (lfn.Option [tlv.Blob ], error ) {
117-
111+ func PackSigs (sigBlob []lfn.Option [tlv.Blob ]) (lfn.Option [tlv.Blob ], error ) {
118112 htlcSigs := make ([][]* cmsg.AssetSig , len (sigBlob ))
119113 for idx := range sigBlob {
120114 err := lfn .MapOptionZ (
@@ -150,9 +144,7 @@ func (s *AuxLeafSigner) PackSigs(
150144
151145// UnpackSigs takes a packed blob of signatures and returns the original
152146// signatures for each HTLC, keyed by HTLC index.
153- func (s * AuxLeafSigner ) UnpackSigs (
154- blob lfn.Option [tlv.Blob ]) ([]lfn.Option [tlv.Blob ], error ) {
155-
147+ func UnpackSigs (blob lfn.Option [tlv.Blob ]) ([]lfn.Option [tlv.Blob ], error ) {
156148 if blob .IsNone () {
157149 return nil , nil
158150 }
@@ -173,8 +165,9 @@ func (s *AuxLeafSigner) UnpackSigs(
173165
174166// VerifySecondLevelSigs attempts to synchronously verify a batch of aux sig
175167// jobs.
176- func (s * AuxLeafSigner ) VerifySecondLevelSigs (chanState * channeldb.OpenChannel ,
177- commitTx * wire.MsgTx , verifyJobs []lnwallet.AuxVerifyJob ) error {
168+ func VerifySecondLevelSigs (chainParams * address.ChainParams ,
169+ chanState * channeldb.OpenChannel , commitTx * wire.MsgTx ,
170+ verifyJobs []lnwallet.AuxVerifyJob ) error {
178171
179172 for idx := range verifyJobs {
180173 verifyJob := verifyJobs [idx ]
@@ -225,9 +218,10 @@ func (s *AuxLeafSigner) VerifySecondLevelSigs(chanState *channeldb.OpenChannel,
225218 continue
226219 }
227220
228- err = s .verifyHtlcSignature (
229- chanState , commitTx , verifyJobs [idx ].KeyRing ,
230- assetSigs .Sigs , htlcOutputs , verifyJobs [idx ].BaseAuxJob ,
221+ err = verifyHtlcSignature (
222+ chainParams , chanState , commitTx ,
223+ verifyJobs [idx ].KeyRing , assetSigs .Sigs , htlcOutputs ,
224+ verifyJobs [idx ].BaseAuxJob ,
231225 )
232226 if err != nil {
233227 return fmt .Errorf ("error verifying second level sig: " +
@@ -330,13 +324,14 @@ func (s *AuxLeafSigner) processAuxSigBatch(chanState *channeldb.OpenChannel,
330324
331325// verifyHtlcSignature verifies the HTLC signature in the commitment transaction
332326// described by the sign job.
333- func ( s * AuxLeafSigner ) verifyHtlcSignature (chanState * channeldb. OpenChannel ,
334- commitTx * wire. MsgTx , keyRing lnwallet. CommitmentKeyRing ,
335- sigs [] * cmsg. AssetSig , htlcOutputs []* cmsg.AssetOutput ,
336- baseJob lnwallet.BaseAuxJob ) error {
327+ func verifyHtlcSignature (chainParams * address. ChainParams ,
328+ chanState * channeldb. OpenChannel , commitTx * wire. MsgTx ,
329+ keyRing lnwallet. CommitmentKeyRing , sigs []* cmsg.AssetSig ,
330+ htlcOutputs [] * cmsg. AssetOutput , baseJob lnwallet.BaseAuxJob ) error {
337331
338- vPackets , err := s .htlcSecondLevelPacketsFromCommit (
339- chanState , commitTx , baseJob .KeyRing , htlcOutputs , baseJob ,
332+ vPackets , err := htlcSecondLevelPacketsFromCommit (
333+ chainParams , chanState , commitTx , baseJob .KeyRing , htlcOutputs ,
334+ baseJob ,
340335 )
341336 if err != nil {
342337 return fmt .Errorf ("error generating second level packets: %w" ,
@@ -470,8 +465,9 @@ func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel,
470465 signDesc input.SignDescriptor ,
471466 baseJob lnwallet.BaseAuxJob ) (lnwallet.AuxSigJobResp , error ) {
472467
473- vPackets , err := s .htlcSecondLevelPacketsFromCommit (
474- chanState , commitTx , baseJob .KeyRing , htlcOutputs , baseJob ,
468+ vPackets , err := htlcSecondLevelPacketsFromCommit (
469+ s .cfg .ChainParams , chanState , commitTx , baseJob .KeyRing ,
470+ htlcOutputs , baseJob ,
475471 )
476472 if err != nil {
477473 return lnwallet.AuxSigJobResp {}, fmt .Errorf ("error generating " +
@@ -556,14 +552,14 @@ func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel,
556552// htlcSecondLevelPacketsFromCommit generates the HTLC second level packets from
557553// the commitment transaction. A bool is returned indicating if the HTLC was
558554// incoming or outgoing.
559- func ( s * AuxLeafSigner ) htlcSecondLevelPacketsFromCommit (
555+ func htlcSecondLevelPacketsFromCommit ( chainParams * address. ChainParams ,
560556 chanState * channeldb.OpenChannel , commitTx * wire.MsgTx ,
561557 keyRing lnwallet.CommitmentKeyRing , htlcOutputs []* cmsg.AssetOutput ,
562558 baseJob lnwallet.BaseAuxJob ) ([]* tappsbt.VPacket , error ) {
563559
564560 packets , _ , err := CreateSecondLevelHtlcPackets (
565561 chanState , commitTx , baseJob .HTLC .Amount .ToSatoshis (),
566- keyRing , s . cfg . ChainParams , htlcOutputs ,
562+ keyRing , chainParams , htlcOutputs ,
567563 )
568564 if err != nil {
569565 return nil , fmt .Errorf ("error creating second level HTLC " +
0 commit comments