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

pull/29489/head
Aaron Chen 5 months ago committed by GitHub
parent cfc7d06cc9
commit ed4bc7f27b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      accounts/external/backend.go
  2. 2
      cmd/devp2p/internal/ethtest/transaction.go
  3. 2
      core/blockchain.go
  4. 3
      internal/era/iterator.go
  5. 4
      miner/worker.go

@ -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

@ -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 {

@ -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)

@ -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)

@ -75,7 +75,7 @@ type newPayloadResult struct {
receipts []*types.Receipt // Receipts collected during construction
}
// generateParams wraps various of settings for generating sealing task.
// generateParams wraps various settings for generating sealing task.
type generateParams struct {
timestamp uint64 // The timestamp for sealing task
forceTime bool // Flag whether the given timestamp is immutable or not
@ -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()
}

Loading…
Cancel
Save