mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
eth: Fix #3483
This commit is contained in:
parent
9d187f0238
commit
0bba5ff394
1 changed files with 5 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
"math/big"
|
||||
|
||||
"errors"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
|
|
@ -90,6 +91,10 @@ func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.
|
|||
// Otherwise resolve the block number and return its state
|
||||
header, err := b.HeaderByNumber(ctx, blockNr)
|
||||
if header == nil || err != nil {
|
||||
//if the error is nil, let's create a generic error message instead of returning a fully null result
|
||||
if err == nil {
|
||||
err = errors.New("blockchain header is nil")
|
||||
}
|
||||
return nil, nil, err
|
||||
}
|
||||
stateDb, err := b.eth.BlockChain().StateAt(header.Root)
|
||||
|
|
|
|||
Loading…
Reference in a new issue