@@ -3,6 +3,7 @@ package main
33import  (
44	"bytes" 
55	"encoding/hex" 
6+ 	"errors" 
67	"fmt" 
78
89	"github.com/btcsuite/btcd/btcec/v2" 
@@ -292,7 +293,7 @@ func closePoolAccount(extendedKey *hdkeychain.ExtendedKey, apiURL string,
292293		signDesc .SignMethod  =  input .TaprootScriptSpendSignMethod 
293294	}
294295	feeRateKWeight  :=  chainfee .SatPerKVByte (1000  *  feeRate ).FeePerKWeight ()
295- 	totalFee  :=  feeRateKWeight .FeeForWeight (int64 ( estimator .Weight () ))
296+ 	totalFee  :=  feeRateKWeight .FeeForWeight (estimator .Weight ())
296297
297298	// Add our sweep destination output. 
298299	sweepTx .TxOut  =  []* wire.TxOut {{
@@ -367,7 +368,7 @@ func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey,
367368	maxNumBatchKeys  uint32 , targetScript  []byte ) (* poolAccount , error ) {
368369
369370	// The outermost loop is over the possible accounts. 
370- 	for  i  :=  uint32 ( 0 );  i   <   maxNumAccounts ;  i ++  {
371+ 	for  i  :=  range   maxNumAccounts  {
371372		accountExtendedKey , err  :=  accountBaseKey .DeriveNonStandard (i )
372373		if  err  !=  nil  {
373374			return  nil , fmt .Errorf ("error deriving account key: " + 
@@ -430,7 +431,7 @@ func bruteForceAccountScript(accountBaseKey *hdkeychain.ExtendedKey,
430431		log .Debugf ("Tried account index %d of %d" , i , maxNumAccounts )
431432	}
432433
433- 	return  nil , fmt . Errorf ("account script not derived" )
434+ 	return  nil , errors . New ("account script not derived" )
434435}
435436
436437func  fastScript (keyIndex , expiryFrom , expiryTo  uint32 , traderKey , auctioneerKey ,
@@ -442,7 +443,7 @@ func fastScript(keyIndex, expiryFrom, expiryTo uint32, traderKey, auctioneerKey,
442443		return  nil , err 
443444	}
444445	if  script .Class () !=  txscript .WitnessV0ScriptHashTy  {
445- 		return  nil , fmt . Errorf ("incompatible script class" )
446+ 		return  nil , errors . New ("incompatible script class" )
446447	}
447448
448449	traderKeyTweak  :=  poolscript .TraderKeyTweak (batchKey , secret , traderKey )
@@ -492,7 +493,7 @@ func fastScript(keyIndex, expiryFrom, expiryTo uint32, traderKey, auctioneerKey,
492493		}, nil 
493494	}
494495
495- 	return  nil , fmt . Errorf ("account script not derived" )
496+ 	return  nil , errors . New ("account script not derived" )
496497}
497498
498499func  fastScriptTaproot (scriptVersion  poolscript.Version , keyIndex , expiryFrom ,
@@ -504,7 +505,7 @@ func fastScriptTaproot(scriptVersion poolscript.Version, keyIndex, expiryFrom,
504505		return  nil , err 
505506	}
506507	if  parsedScript .Class () !=  txscript .WitnessV1TaprootTy  {
507- 		return  nil , fmt . Errorf ("incompatible script class" )
508+ 		return  nil , errors . New ("incompatible script class" )
508509	}
509510
510511	traderKeyTweak  :=  poolscript .TraderKeyTweak (batchKey , secret , traderKey )
@@ -601,5 +602,5 @@ func fastScriptTaproot(scriptVersion poolscript.Version, keyIndex, expiryFrom,
601602		}, nil 
602603	}
603604
604- 	return  nil , fmt . Errorf ("account script not derived" )
605+ 	return  nil , errors . New ("account script not derived" )
605606}
0 commit comments