You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeHeaderstruct {
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"`BloomBloom`json:"logsBloom" gencodec:"required"`Difficulty*big.Int`json:"difficulty" gencodec:"required"`Number*big.Int`json:"number" gencodec:"required"`GasLimituint64`json:"gasLimit" gencodec:"required"`GasUseduint64`json:"gasUsed" gencodec:"required"`Timeuint64`json:"timestamp" gencodec:"required"`Extra []byte`json:"extraData" gencodec:"required"`MixDigest common.Hash`json:"mixHash"`NonceBlockNonce`json:"nonce"`// BaseFee was added by EIP-1559 and is ignored in legacy headers.BaseFee*big.Int`json:"baseFeePerGas" rlp:"optional"`
}
Blockchain:区块链
基础数据结构
typeBlockChainstruct {
chainConfig*params.ChainConfig// Chain & network configurationcacheConfig*CacheConfig// Cache configuration for pruningdb ethdb.Database// Low level persistent database to store final content insnaps*snapshot.Tree// Snapshot tree for fast trie leaf accesstriegc*prque.Prque// Priority queue mapping block numbers to tries to gcgcproc time.Duration// Accumulates canonical block processing for trie dumping// txLookupLimit is the maximum number of blocks from head whose tx indices// are reserved:// * 0: means no limit and regenerate any missing indexes// * N: means N block limit [HEAD-N+1, HEAD] and delete extra indexes// * nil: disable tx reindexer/deleter, but still index new blockstxLookupLimituint64hc*HeaderChainrmLogsFeed event.FeedchainFeed event.FeedchainSideFeed event.FeedchainHeadFeed event.FeedlogsFeed event.FeedblockProcFeed event.Feedscope event.SubscriptionScopegenesisBlock*types.Block// This mutex synchronizes chain write operations.// Readers don't need to take it, they can just read the database.chainmu*syncx.ClosableMutexcurrentBlock atomic.Value// Current head of the block chaincurrentFastBlock atomic.Value// Current head of the fast-sync chain (may be above the block chain!)stateCache state.Database// State database to reuse between imports (contains state cache)bodyCache*lru.Cache// Cache for the most recent block bodiesbodyRLPCache*lru.Cache// Cache for the most recent block bodies in RLP encoded formatreceiptsCache*lru.Cache// Cache for the most recent receipts per blockblockCache*lru.Cache// Cache for the most recent entire blockstxLookupCache*lru.Cache// Cache for the most recent transaction lookup data.futureBlocks*lru.Cache// future blocks are blocks added for later processingwg sync.WaitGroup//quitchanstruct{} // shutdown signal, closed in Stop.runningint32// 0 if chain is running, 1 when stoppedprocInterruptint32// interrupt signaler for block processingengine consensus.EnginevalidatorValidator// Block and state validator interfaceprefetcherPrefetcherprocessorProcessor// Block transaction processor interfaceforker*ForkChoicevmConfig vm.Config
}