GetHeaderByNumber retrieves a block header from the database by number, caching it (associated with its hash) if found.
(number uint64)
| 376 | // GetHeaderByNumber retrieves a block header from the database by number, |
| 377 | // caching it (associated with its hash) if found. |
| 378 | func (hc *HeaderChain) GetHeaderByNumber(number uint64) *types.Header { |
| 379 | hash := rawdb.ReadCanonicalHash(hc.chainDb, number) |
| 380 | if hash == (common.Hash{}) { |
| 381 | return nil |
| 382 | } |
| 383 | return hc.GetHeader(hash, number) |
| 384 | } |
| 385 | |
| 386 | // CurrentHeader retrieves the current head header of the canonical chain. The |
| 387 | // header is retrieved from the HeaderChain's internal cache. |
no test coverage detected