all: replace fmt.Errorf() with errors.New() if no param required

This commit is contained in:
Aaron Chen 2024-04-06 14:07:37 +08:00 committed by GitHub
parent 4458905f26
commit 5677758b9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 5 additions and 6 deletions

View file

@ -239,7 +239,7 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
args.BlobHashes = tx.BlobHashes()
sidecar := tx.BlobTxSidecar()
if sidecar == nil {
return nil, fmt.Errorf("blobs must be present for signing")
return nil, errors.New("blobs must be present for signing")
}
args.Blobs = sidecar.Blobs
args.Commitments = sidecar.Commitments

View file

@ -102,7 +102,7 @@ func (s *Suite) sendTxs(t *utesting.T, txs []*types.Transaction) error {
}
}
return fmt.Errorf("timed out waiting for txs")
return errors.New("timed out waiting for txs")
}
func (s *Suite) sendInvalidTxs(t *utesting.T, txs []*types.Transaction) error {

View file

@ -439,7 +439,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
}
if alloc == nil {
return nil, fmt.Errorf("live blockchain tracer requires genesis alloc to be set")
return nil, errors.New("live blockchain tracer requires genesis alloc to be set")
}
bc.logger.OnGenesisBlock(bc.genesisBlock, alloc)

View file

@ -18,7 +18,6 @@ package era
import (
"errors"
"fmt"
"io"
"math/big"
@ -80,7 +79,7 @@ func (it *Iterator) Block() (*types.Block, error) {
// Receipts returns the receipts for the iterator's current position.
func (it *Iterator) Receipts() (types.Receipts, error) {
if it.inner.Receipts == nil {
return nil, fmt.Errorf("receipts must be non-nil")
return nil, errors.New("receipts must be non-nil")
}
var receipts types.Receipts
err := rlp.Decode(it.inner.Receipts, &receipts)

View file

@ -131,7 +131,7 @@ func (miner *Miner) prepareWork(genParams *generateParams) (*environment, error)
if genParams.parentHash != (common.Hash{}) {
block := miner.chain.GetBlockByHash(genParams.parentHash)
if block == nil {
return nil, fmt.Errorf("missing parent")
return nil, errors.New("missing parent")
}
parent = block.Header()
}