mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Fix GetHeader
This commit is contained in:
parent
2209cb486a
commit
26f20b21b4
1 changed files with 5 additions and 2 deletions
|
|
@ -109,8 +109,11 @@ func (m *simChainHeadReader) CurrentHeader() *types.Header {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *simChainHeadReader) GetHeader(hash common.Hash, number uint64) *types.Header {
|
func (m *simChainHeadReader) GetHeader(hash common.Hash, number uint64) *types.Header {
|
||||||
header, err := m.Backend.HeaderByHash(m.Context, hash)
|
header, err := m.Backend.HeaderByNumber(m.Context, rpc.BlockNumber(number))
|
||||||
if err != nil {
|
if err != nil || header == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if header.Hash() != hash {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return header
|
return header
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue