Documentation ¶
Index ¶
- Constants
- func CalcBaseFee(config *ethparams.ChainConfig, parent *Header) *big.Int
- func InitHeaderStore(state types.StateDB, header *Header, td *big.Int) error
- func VerifyEip1559Header(config *ethparams.ChainConfig, parent, header *Header) error
- type Cache
- type Header
- type HeaderStore
- func (hs *HeaderStore) CurrentHash() common.Hash
- func (hs *HeaderStore) CurrentNumber() uint64
- func (hs *HeaderStore) DecodeRLP(s *rlp.Stream) error
- func (hs *HeaderStore) DeleteCanonicalHash(number uint64)
- func (hs *HeaderStore) EncodeRLP(w io.Writer) error
- func (hs *HeaderStore) GetCurrentNumberAndHash(db types.StateDB) (uint64, common.Hash, error)
- func (hs *HeaderStore) GetHashByNumber(db types.StateDB, number uint64) (common.Hash, error)
- func (hs *HeaderStore) GetHeader(hash common.Hash, number uint64) *Header
- func (hs *HeaderStore) GetHeaderByNumber(number uint64) *Header
- func (hs *HeaderStore) GetTd(hash common.Hash, number uint64) *big.Int
- func (hs *HeaderStore) HasHeader(hash common.Hash, number uint64) bool
- func (hs *HeaderStore) InsertHeaders(db types.StateDB, ethHeaders []byte) ([]*params.NumberHash, error)
- func (hs *HeaderStore) Load(state types.StateDB) (err error)
- func (hs *HeaderStore) ReadCanonicalHash(number uint64) common.Hash
- func (hs *HeaderStore) ResetHeaderStore(state types.StateDB, ethHeaders []byte, td *big.Int) error
- func (hs *HeaderStore) Store(state types.StateDB) error
- func (hs *HeaderStore) WriteCanonicalHash(hash common.Hash, number uint64)
- func (hs *HeaderStore) WriteHeader(header *Header)
- func (hs *HeaderStore) WriteHeaders(db types.StateDB, ethHeaders []byte) (*headerWriteResult, error)
- func (hs *HeaderStore) WriteTd(hash common.Hash, number uint64, td *big.Int)
- type TxProve
- type Validate
- type Verify
- type WriteStatus
Constants ¶
View Source
const ( StoreCacheSize = 20 MaxHeaderLimit = 200000 SplicingSymbol = "-" )
Variables ¶
This section is empty.
Functions ¶
func CalcBaseFee ¶
func CalcBaseFee(config *ethparams.ChainConfig, parent *Header) *big.Int
CalcBaseFee calculates the basefee of the header.
func VerifyEip1559Header ¶
func VerifyEip1559Header(config *ethparams.ChainConfig, parent, header *Header) error
Types ¶
type Header ¶
type Header struct { ParentHash common.Hash `json:"parentHash" gencodec:"required"` UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` Coinbase common.Address `json:"miner" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` Bloom types.Bloom `json:"logsBloom" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time uint64 `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash"` Nonce types.BlockNonce `json:"nonce"` // BaseFee was added by EIP-1559 and is ignored in legacy headers. BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"` }
type HeaderStore ¶
type HeaderStore struct { CanonicalNumberToHash map[uint64]common.Hash Headers map[string][]byte TDs map[string]*big.Int CurNumber uint64 CurHash common.Hash }
func NewHeaderStore ¶
func NewHeaderStore() *HeaderStore
func (*HeaderStore) CurrentHash ¶
func (hs *HeaderStore) CurrentHash() common.Hash
func (*HeaderStore) CurrentNumber ¶
func (hs *HeaderStore) CurrentNumber() uint64
func (*HeaderStore) DeleteCanonicalHash ¶
func (hs *HeaderStore) DeleteCanonicalHash(number uint64)
func (*HeaderStore) GetCurrentNumberAndHash ¶
func (*HeaderStore) GetHashByNumber ¶
func (*HeaderStore) GetHeader ¶
func (hs *HeaderStore) GetHeader(hash common.Hash, number uint64) *Header
func (*HeaderStore) GetHeaderByNumber ¶
func (hs *HeaderStore) GetHeaderByNumber(number uint64) *Header
func (*HeaderStore) HasHeader ¶
func (hs *HeaderStore) HasHeader(hash common.Hash, number uint64) bool
func (*HeaderStore) InsertHeaders ¶
func (hs *HeaderStore) InsertHeaders(db types.StateDB, ethHeaders []byte) ([]*params.NumberHash, error)
func (*HeaderStore) ReadCanonicalHash ¶
func (hs *HeaderStore) ReadCanonicalHash(number uint64) common.Hash
func (*HeaderStore) ResetHeaderStore ¶
func (*HeaderStore) WriteCanonicalHash ¶
func (hs *HeaderStore) WriteCanonicalHash(hash common.Hash, number uint64)
func (*HeaderStore) WriteHeader ¶
func (hs *HeaderStore) WriteHeader(header *Header)
func (*HeaderStore) WriteHeaders ¶
func (hs *HeaderStore) WriteHeaders(db types.StateDB, ethHeaders []byte) (*headerWriteResult, error)
type Validate ¶
type Validate struct{}
func (*Validate) ValidateHeaderChain ¶
func (*Validate) VerifyHeaders ¶
type WriteStatus ¶
type WriteStatus byte
WriteStatus status of write
const ( NonStatTy WriteStatus = iota CanonStatTy SideStatTy )
Click to show internal directories.
Click to hide internal directories.