@@ -136,15 +136,15 @@ func (c *sweepTimeLockManualCommand) Execute(_ *cobra.Command, _ []string) error
136136
137137 return sweepTimeLockManual (
138138 extendedKey , c .APIURL , c .SweepAddr , c .TimeLockAddr ,
139- remoteRevPoint , c .MaxCsvLimit , c .MaxNumChansTotal ,
139+ remoteRevPoint , 0 , c .MaxCsvLimit , 0 , c .MaxNumChansTotal ,
140140 c .MaxNumChanUpdates , c .Publish , c .FeeRate ,
141141 )
142142}
143143
144144func sweepTimeLockManual (extendedKey * hdkeychain.ExtendedKey , apiURL string ,
145145 sweepAddr , timeLockAddr string , remoteRevPoint * btcec.PublicKey ,
146- maxCsvTimeout , maxNumChannels uint16 , maxNumChanUpdates uint64 ,
147- publish bool , feeRate uint32 ) error {
146+ startCsvTimeout , maxCsvTimeout , startNumChannels , maxNumChannels uint16 ,
147+ maxNumChanUpdates uint64 , publish bool , feeRate uint32 ) error {
148148
149149 // First of all, we need to parse the lock addr and make sure we can
150150 // brute force the script with the information we have. If not, we can't
@@ -179,10 +179,10 @@ func sweepTimeLockManual(extendedKey *hdkeychain.ExtendedKey, apiURL string,
179179 delayDesc * keychain.KeyDescriptor
180180 commitPoint * btcec.PublicKey
181181 )
182- for i := uint16 ( 0 ) ; i < maxNumChannels ; i ++ {
182+ for i := startNumChannels ; i < maxNumChannels ; i ++ {
183183 csvTimeout , script , scriptHash , commitPoint , delayDesc , err = tryKey (
184- baseKey , remoteRevPoint , maxCsvTimeout , lockScript ,
185- uint32 (i ), maxNumChanUpdates ,
184+ baseKey , remoteRevPoint , startCsvTimeout , maxCsvTimeout ,
185+ lockScript , uint32 (i ), maxNumChanUpdates ,
186186 )
187187
188188 if err == nil {
@@ -305,7 +305,7 @@ func sweepTimeLockManual(extendedKey *hdkeychain.ExtendedKey, apiURL string,
305305}
306306
307307func tryKey (baseKey * hdkeychain.ExtendedKey , remoteRevPoint * btcec.PublicKey ,
308- maxCsvTimeout uint16 , lockScript []byte , idx uint32 ,
308+ startCsvTimeout , maxCsvTimeout uint16 , lockScript []byte , idx uint32 ,
309309 maxNumChanUpdates uint64 ) (int32 , []byte , []byte , * btcec.PublicKey ,
310310 * keychain.KeyDescriptor , error ) {
311311
@@ -338,7 +338,7 @@ func tryKey(baseKey *hdkeychain.ExtendedKey, remoteRevPoint *btcec.PublicKey,
338338 // points and CSV values.
339339 csvTimeout , script , scriptHash , commitPoint , err := bruteForceDelayPoint (
340340 delayPrivKey .PubKey (), remoteRevPoint , revRoot , lockScript ,
341- maxCsvTimeout , maxNumChanUpdates ,
341+ startCsvTimeout , maxCsvTimeout , maxNumChanUpdates ,
342342 )
343343 if err == nil {
344344 return csvTimeout , script , scriptHash , commitPoint ,
@@ -403,7 +403,7 @@ func tryKey(baseKey *hdkeychain.ExtendedKey, remoteRevPoint *btcec.PublicKey,
403403
404404 csvTimeout , script , scriptHash , commitPoint , err = bruteForceDelayPoint (
405405 delayPrivKey .PubKey (), remoteRevPoint , revRoot2 , lockScript ,
406- maxCsvTimeout , maxNumChanUpdates ,
406+ startCsvTimeout , maxCsvTimeout , maxNumChanUpdates ,
407407 )
408408 if err == nil {
409409 return csvTimeout , script , scriptHash , commitPoint ,
@@ -444,7 +444,7 @@ func tryKey(baseKey *hdkeychain.ExtendedKey, remoteRevPoint *btcec.PublicKey,
444444
445445 csvTimeout , script , scriptHash , commitPoint , err = bruteForceDelayPoint (
446446 delayPrivKey .PubKey (), remoteRevPoint , revRoot3 , lockScript ,
447- maxCsvTimeout , maxNumChanUpdates ,
447+ startCsvTimeout , maxCsvTimeout , maxNumChanUpdates ,
448448 )
449449 if err == nil {
450450 return csvTimeout , script , scriptHash , commitPoint ,
@@ -462,8 +462,8 @@ func tryKey(baseKey *hdkeychain.ExtendedKey, remoteRevPoint *btcec.PublicKey,
462462
463463func bruteForceDelayPoint (delayBase , revBase * btcec.PublicKey ,
464464 revRoot * shachain.RevocationProducer , lockScript []byte ,
465- maxCsvTimeout uint16 , maxChanUpdates uint64 ) (int32 , [] byte , [] byte ,
466- * btcec.PublicKey , error ) {
465+ startCsvTimeout , maxCsvTimeout uint16 , maxChanUpdates uint64 ) (int32 ,
466+ [] byte , [] byte , * btcec.PublicKey , error ) {
467467
468468 for i := uint64 (0 ); i < maxChanUpdates ; i ++ {
469469 revPreimage , err := revRoot .AtIndex (i )
@@ -475,7 +475,7 @@ func bruteForceDelayPoint(delayBase, revBase *btcec.PublicKey,
475475 csvTimeout , script , scriptHash , err := bruteForceDelay (
476476 input .TweakPubKey (delayBase , commitPoint ),
477477 input .DeriveRevocationPubkey (revBase , commitPoint ),
478- lockScript , maxCsvTimeout ,
478+ lockScript , startCsvTimeout , maxCsvTimeout ,
479479 )
480480
481481 if err != nil {
0 commit comments