mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
eth: let function HeaderByNumber return error when header is nil
This commit is contained in:
parent
f34087534d
commit
b2a767e660
1 changed files with 5 additions and 1 deletions
|
|
@ -99,7 +99,11 @@ func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNum
|
||||||
return nil, errors.New("PoS V1 does not support confirmed block lookup")
|
return nil, errors.New("PoS V1 does not support confirmed block lookup")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return b.eth.blockchain.GetHeaderByNumber(uint64(blockNr)), nil
|
header := b.eth.blockchain.GetHeaderByNumber(uint64(blockNr))
|
||||||
|
if header == nil {
|
||||||
|
return nil, errors.New("header for number not found")
|
||||||
|
}
|
||||||
|
return header, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *EthApiBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error) {
|
func (b *EthApiBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue