mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
core: improve contextual information on core errors (#21869)
This commit is contained in:
parent
05e9dc0def
commit
2ff9f336ed
4 changed files with 4 additions and 8 deletions
|
|
@ -439,7 +439,7 @@ func testBadHashes(t *testing.T, full bool) {
|
|||
|
||||
_, err = blockchain.InsertHeaderChain(headers, 1)
|
||||
}
|
||||
if err != ErrBlacklistedHash {
|
||||
if !errors.Is(err, ErrBlacklistedHash) {
|
||||
t.Errorf("error mismatch: have: %v, want: %v", err, ErrBlacklistedHash)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, tra
|
|||
statedb.SetTxContext(tx.Hash(), i)
|
||||
receipt, gas, err, tokenFeeUsed := applyTransaction(p.config, balanceFee, gp, statedb, coinbaseOwner, blockNumber, header.BaseFee, blockHash, tx, usedGas, vmenv)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
return nil, nil, 0, fmt.Errorf("could not apply tx %d [%v]: %w", i, tx.Hash().Hex(), err)
|
||||
}
|
||||
receipts = append(receipts, receipt)
|
||||
allLogs = append(allLogs, receipt.Logs...)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
|
|
@ -32,10 +31,6 @@ import (
|
|||
|
||||
var emptyCodeHash = crypto.Keccak256Hash(nil)
|
||||
|
||||
var (
|
||||
errInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas")
|
||||
)
|
||||
|
||||
/*
|
||||
The State Transitioning Model
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package light
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
|
|
@ -317,7 +318,7 @@ func TestBadHeaderHashes(t *testing.T) {
|
|||
var err error
|
||||
headers := makeHeaderChainWithDiff(bc.genesisBlock, []int{1, 2, 4}, 10)
|
||||
core.BadHashes[headers[2].Hash()] = true
|
||||
if _, err = bc.InsertHeaderChain(headers, 1); err != core.ErrBlacklistedHash {
|
||||
if _, err = bc.InsertHeaderChain(headers, 1); !errors.Is(err, core.ErrBlacklistedHash) {
|
||||
t.Errorf("error mismatch: have: %v, want %v", err, core.ErrBlacklistedHash)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue