@@ -478,16 +478,16 @@ func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args Transacti
478
478
// No need to obtain the noncelock mutex, since we won't be sending this
479
479
// tx into the transaction pool, but right back to the user
480
480
if args .From == nil {
481
- return nil , fmt . Errorf ("sender not specified" )
481
+ return nil , errors . New ("sender not specified" )
482
482
}
483
483
if args .Gas == nil {
484
- return nil , fmt . Errorf ("gas not specified" )
484
+ return nil , errors . New ("gas not specified" )
485
485
}
486
486
if args .GasPrice == nil && (args .MaxFeePerGas == nil || args .MaxPriorityFeePerGas == nil ) {
487
- return nil , fmt . Errorf ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
487
+ return nil , errors . New ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
488
488
}
489
489
if args .Nonce == nil {
490
- return nil , fmt . Errorf ("nonce not specified" )
490
+ return nil , errors . New ("nonce not specified" )
491
491
}
492
492
// Before actually signing the transaction, ensure the transaction fee is reasonable.
493
493
tx := args .toTransaction ()
@@ -548,7 +548,7 @@ func (s *PersonalAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.By
548
548
return common.Address {}, fmt .Errorf ("signature must be %d bytes long" , crypto .SignatureLength )
549
549
}
550
550
if sig [crypto .RecoveryIDOffset ] != 27 && sig [crypto .RecoveryIDOffset ] != 28 {
551
- return common.Address {}, fmt . Errorf ("invalid Ethereum signature (V is not 27 or 28)" )
551
+ return common.Address {}, errors . New ("invalid Ethereum signature (V is not 27 or 28)" )
552
552
}
553
553
sig [crypto .RecoveryIDOffset ] -= 27 // Transform yellow paper V from 27/28 to 0/1
554
554
@@ -582,7 +582,7 @@ func (s *PersonalAccountAPI) InitializeWallet(ctx context.Context, url string) (
582
582
case * scwallet.Wallet :
583
583
return mnemonic , wallet .Initialize (seed )
584
584
default :
585
- return "" , fmt . Errorf ("specified wallet does not support initialization" )
585
+ return "" , errors . New ("specified wallet does not support initialization" )
586
586
}
587
587
}
588
588
@@ -597,7 +597,7 @@ func (s *PersonalAccountAPI) Unpair(ctx context.Context, url string, pin string)
597
597
case * scwallet.Wallet :
598
598
return wallet .Unpair ([]byte (pin ))
599
599
default :
600
- return fmt . Errorf ("specified wallet does not support pairing" )
600
+ return errors . New ("specified wallet does not support pairing" )
601
601
}
602
602
}
603
603
@@ -722,10 +722,10 @@ func decodeHash(s string) (common.Hash, error) {
722
722
}
723
723
b , err := hex .DecodeString (s )
724
724
if err != nil {
725
- return common.Hash {}, fmt . Errorf ("hex string invalid" )
725
+ return common.Hash {}, errors . New ("hex string invalid" )
726
726
}
727
727
if len (b ) > 32 {
728
- return common.Hash {}, fmt . Errorf ("hex string too long, want at most 32 bytes" )
728
+ return common.Hash {}, errors . New ("hex string too long, want at most 32 bytes" )
729
729
}
730
730
return common .BytesToHash (b ), nil
731
731
}
@@ -1833,13 +1833,13 @@ type SignTransactionResult struct {
1833
1833
// the given from address and it needs to be unlocked.
1834
1834
func (s * TransactionAPI ) SignTransaction (ctx context.Context , args TransactionArgs ) (* SignTransactionResult , error ) {
1835
1835
if args .Gas == nil {
1836
- return nil , fmt . Errorf ("gas not specified" )
1836
+ return nil , errors . New ("gas not specified" )
1837
1837
}
1838
1838
if args .GasPrice == nil && (args .MaxPriorityFeePerGas == nil || args .MaxFeePerGas == nil ) {
1839
- return nil , fmt . Errorf ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
1839
+ return nil , errors . New ("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas" )
1840
1840
}
1841
1841
if args .Nonce == nil {
1842
- return nil , fmt . Errorf ("nonce not specified" )
1842
+ return nil , errors . New ("nonce not specified" )
1843
1843
}
1844
1844
if err := args .setDefaults (ctx , s .b ); err != nil {
1845
1845
return nil , err
@@ -1888,7 +1888,7 @@ func (s *TransactionAPI) PendingTransactions() ([]*RPCTransaction, error) {
1888
1888
// the given transaction from the pool and reinsert it with the new gas price and limit.
1889
1889
func (s * TransactionAPI ) Resend (ctx context.Context , sendArgs TransactionArgs , gasPrice * hexutil.Big , gasLimit * hexutil.Uint64 ) (common.Hash , error ) {
1890
1890
if sendArgs .Nonce == nil {
1891
- return common.Hash {}, fmt . Errorf ("missing transaction nonce in transaction spec" )
1891
+ return common.Hash {}, errors . New ("missing transaction nonce in transaction spec" )
1892
1892
}
1893
1893
if err := sendArgs .setDefaults (ctx , s .b ); err != nil {
1894
1894
return common.Hash {}, err
0 commit comments