HeaderChain

// HeaderChain implements the basic block header chain logic that is shared by
// core.BlockChain and light.LightChain. It is not usable in itself, only as
// a part of either structure.
// It is not thread safe either, the encapsulating chain structures should do
// the necessary mutex locking/unlocking.
type HeaderChain struct {
    config *params.ChainConfig

    chainDb       serodb.Database
    genesisHeader *types.Header

    currentHeader     atomic.Value // Current head of the header chain (may be above the block chain!)
    currentHeaderHash common.Hash  // Hash of the current head of the header chain (prevent recomputing all the time)

    headerCache *lru.Cache // Cache for the most recent block headers
    tdCache     *lru.Cache // Cache for the most recent block total difficulties
    numberCache *lru.Cache // Cache for the most recent block numbers

    procInterrupt func() bool

    rand   *mrand.Rand
    engine consensus.Engine
}

Last updated

Was this helpful?