fix: even if no body, should return block with header

This commit is contained in:
mobus 2023-10-26 11:57:41 +08:00
parent 58ae1df684
commit cfd9c4df04

View file

@ -763,7 +763,7 @@ func ReadBlock(db ethdb.Reader, hash common.Hash, number uint64) *types.Block {
}
body := ReadBody(db, hash, number)
if body == nil {
return nil
return types.NewBlockWithHeader(header)
}
return types.NewBlockWithHeader(header).WithBody(body.Transactions, body.Uncles).WithWithdrawals(body.Withdrawals)
}