Versions in this module Expand all Collapse all v1 v1.1.1 Oct 29, 2019 Changes in this version + const BlockChainVersion + const IdealBatchSize + var BloomBitsIndexPrefix = []byte("iB") + var ErrChainConfigNotFound = errors.New("ChainConfig not found") + var ErrNoGenesis = errors.New("Genesis not found in chain") + func DeleteBlock(db DatabaseDeleter, hash types.Hash, number uint64) + func DeleteBlockReceipts(db DatabaseDeleter, hash types.Hash, number uint64) + func DeleteBody(db DatabaseDeleter, hash types.Hash, number uint64) + func DeleteCanonicalHash(db DatabaseDeleter, number uint64) + func DeleteHeader(db DatabaseDeleter, hash types.Hash, number uint64) + func DeleteTxAddrNonceLookupEntry(db DatabaseDeleter, tx *transaction.Transaction) + func DeleteTxLookupEntry(db DatabaseDeleter, hash types.Hash) + func FindCommonAncestor(db DatabaseReader, a, b *block.Header) *block.Header + func GetAddrNonceTxLookupEntry(db DatabaseReader, sender types.Address, nonce uint64) (types.Hash, uint64, uint64) + func GetBlock(db DatabaseReader, hash types.Hash, number uint64) *block.Block + func GetBlockChainVersion(db DatabaseReader) int + func GetBlockNumber(db DatabaseReader, hash types.Hash) uint64 + func GetBlockReceipts(db DatabaseReader, hash types.Hash, number uint64) transaction.Receipts + func GetBloomBits(db DatabaseReader, bit uint, section uint64, head types.Hash) ([]byte, error) + func GetBody(db DatabaseReader, hash types.Hash, number uint64) *block.Body + func GetBodyMsgp(db DatabaseReader, hash types.Hash, number uint64) []byte + func GetCanonicalHash(db DatabaseReader, number uint64) types.Hash + func GetChainConfig(db DatabaseReader, hash types.Hash) (*params.ChainConfig, error) + func GetCoinBaseReceipt(db DatabaseReader, blockHash types.Hash, blockNumber uint64) (*transaction.Receipt, types.Hash, uint64, uint64) + func GetExtra(db DatabaseReader, key []byte) []byte + func GetHeadBlockHash(db DatabaseReader) types.Hash + func GetHeadFastBlockHash(db DatabaseReader) types.Hash + func GetHeadHeaderHash(db DatabaseReader) types.Hash + func GetHeader(db DatabaseReader, hash types.Hash, number uint64) *block.Header + func GetHeaderMsgp(db DatabaseReader, hash types.Hash, number uint64) []byte + func GetReceipt(db DatabaseReader, hash types.Hash) (*transaction.Receipt, types.Hash, uint64, uint64) + func GetTransaction(db DatabaseReader, hash types.Hash) (*transaction.Transaction, types.Hash, uint64, uint64) + func GetTransactionByAddress(db DatabaseReader, addr types.Address, nonce uint64) (*transaction.Transaction, types.Hash, uint64, uint64) + func GetTxLookupEntry(db DatabaseReader, hash types.Hash) (types.Hash, uint64, uint64) + func PreimageTable(db database.IDatabase) database.IDatabase + func SetReceiptsData(config *params.ChainConfig, block *block.Block, receipts transaction.Receipts) + func WriteBlock(db database.IDatabasePutter, block *block.Block) error + func WriteBlockChainVersion(db database.IDatabasePutter, vsn int) + func WriteBlockReceipts(db database.IDatabasePutter, hash types.Hash, number uint64, ...) error + func WriteBlockStat(db database.IDatabasePutter, hash types.Hash, stat *BlockStat) error + func WriteBloomBits(db database.IDatabasePutter, bit uint, section uint64, head types.Hash, ...) + func WriteBody(db database.IDatabasePutter, hash types.Hash, number uint64, body *block.Body) error + func WriteBodyMsgp(db database.IDatabasePutter, hash types.Hash, number uint64, data []byte) error + func WriteCanonicalHash(db database.IDatabasePutter, hash types.Hash, number uint64) error + func WriteChainConfig(db database.IDatabasePutter, hash types.Hash, cfg *params.ChainConfig) error + func WriteExtra(db database.IDatabasePutter, key, val []byte) error + func WriteHeadBlockHash(db database.IDatabasePutter, hash types.Hash) error + func WriteHeadFastBlockHash(db database.IDatabasePutter, hash types.Hash) error + func WriteHeadHeaderHash(db database.IDatabasePutter, hash types.Hash) error + func WriteHeader(db database.IDatabasePutter, header *block.Header) error + func WritePreimages(db database.IDatabase, number uint64, preimages map[types.Hash][]byte) error + func WriteTxLookupEntries(db database.IDatabasePutter, block *block.Block) error + type BadBlockArgs struct + Hash types.Hash + Header *block.Header + type BlockChain struct + func NewBlockChain(chainDb database.IDatabase, config *params.ChainConfig, ...) (*BlockChain, error) + func (bc *BlockChain) BadBlocks() ([]BadBlockArgs, error) + func (bc *BlockChain) Config() *params.ChainConfig + func (bc *BlockChain) CurrentBlock() *block.Block + func (bc *BlockChain) CurrentBlockNum() uint64 + func (bc *BlockChain) CurrentFastBlock() *block.Block + func (bc *BlockChain) CurrentHeader() *block.Header + func (bc *BlockChain) Engine() consensus.Engine + func (bc *BlockChain) Export(w io.Writer) error + func (bc *BlockChain) ExportN(w io.Writer, first uint64, last uint64) error + func (bc *BlockChain) FastSyncCommitHead(hash types.Hash) error + func (bc *BlockChain) Genesis() *block.Block + func (bc *BlockChain) GetBlock(hash types.Hash, number uint64) *block.Block + func (bc *BlockChain) GetBlockByHash(hash types.Hash) *block.Block + func (bc *BlockChain) GetBlockByNumber(number uint64) *block.Block + func (bc *BlockChain) GetBlockHashesFromHash(hash types.Hash, max uint64) []types.Hash + func (bc *BlockChain) GetBlockStat(hash types.Hash) *BlockStat + func (bc *BlockChain) GetBlocksFromHash(hash types.Hash, n int) (blocks []*block.Block) + func (bc *BlockChain) GetBody(hash types.Hash) *block.Body + func (bc *BlockChain) GetBodyMsgp(hash types.Hash) []byte + func (bc *BlockChain) GetConsensusData(key types.Hash) []byte + func (bc *BlockChain) GetDb() database.IDatabase + func (bc *BlockChain) GetExtra(key []byte) []byte + func (bc *BlockChain) GetGenesis() *block.Block + func (bc *BlockChain) GetHeader(hash types.Hash, number uint64) *block.Header + func (bc *BlockChain) GetHeaderByHash(hash types.Hash) *block.Header + func (bc *BlockChain) GetHeaderByNumber(number uint64) *block.Header + func (bc *BlockChain) GetNowBlockHash() types.Hash + func (bc *BlockChain) GetReceiptsByHash(hash types.Hash) transaction.Receipts + func (bc *BlockChain) HasBlock(hash types.Hash, number uint64) bool + func (bc *BlockChain) HasBlockAndState(hash types.Hash) bool + func (bc *BlockChain) HasHeader(hash types.Hash, number uint64) bool + func (bc *BlockChain) HasState(hash types.Hash) bool + func (bc *BlockChain) InsertChain(chain block.Blocks) (int, error) + func (bc *BlockChain) InsertHeaderChain(chain []*block.Header, checkFreq int) (int, error) + func (bc *BlockChain) InsertReceiptChain(blockChain block.Blocks, receiptChain []transaction.Receipts) (int, error) + func (bc *BlockChain) LastBlockHash() types.Hash + func (bc *BlockChain) MuLock() + func (bc *BlockChain) MuUnLock() + func (bc *BlockChain) PostChainEvents(events []interface{}, logs []*transaction.Log) + func (bc *BlockChain) Processor() Processor + func (bc *BlockChain) ReportBlock(block *block.Block, receipts transaction.Receipts, err error) + func (bc *BlockChain) Reset() error + func (bc *BlockChain) ResetWithGenesisBlock(genesis *block.Block) error + func (bc *BlockChain) Rollback(chain []types.Hash) + func (bc *BlockChain) SetHead(head uint64) error + func (bc *BlockChain) SetProcessor(processor Processor) + func (bc *BlockChain) SetValidator(validator Validator) + func (bc *BlockChain) State() (*state.StateDB, error) + func (bc *BlockChain) StateAt(root types.Hash) (*state.StateDB, error) + func (bc *BlockChain) StateCache() state.Database + func (bc *BlockChain) Status() (numnber *big.Int, currentBlock types.Hash, genesisBlock types.Hash) + func (bc *BlockChain) Stop() + func (bc *BlockChain) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription + func (bc *BlockChain) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription + func (bc *BlockChain) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription + func (bc *BlockChain) SubscribeLogsEvent(ch chan<- []*transaction.Log) event.Subscription + func (bc *BlockChain) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription + func (bc *BlockChain) Test_insert(block *block.Block) + func (bc *BlockChain) Validate() Validator + func (bc *BlockChain) Validator() Validator + func (bc *BlockChain) VerifyNextRoundBlock(block *block.Block) bool + func (bc *BlockChain) WriteBlockAndState(block *block.Block, receipts []*transaction.Receipt, state *state.StateDB) (status WriteStatus, err error) + func (bc *BlockChain) WriteConsensusData(key types.Hash, value []byte) error + type BlockStat struct + TsoContract *types.BigInt + TsoNormal *types.BigInt + TstateNum *types.BigInt + Ttxs *types.BigInt + func GetBlockStat(db DatabaseReader, hash types.Hash) *BlockStat + func (z *BlockStat) DecodeMsg(dc *msgp.Reader) (err error) + func (z *BlockStat) EncodeMsg(en *msgp.Writer) (err error) + func (z *BlockStat) MarshalMsg(b []byte) (o []byte, err error) + func (z *BlockStat) Msgsize() (s int) + func (z *BlockStat) UnmarshalMsg(bts []byte) (o []byte, err error) + type BlockValidator struct + func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engine consensus.Engine) *BlockValidator + func (v *BlockValidator) ValidateBody(blk *block.Block) error + func (v *BlockValidator) ValidateState(blk, parent *block.Block, statedb *state.StateDB, ...) error + type CacheConfig struct + Disabled bool + TrieNodeLimit int + TrieTimeLimit time.Duration + type DatabaseDeleter interface + Delete func(key []byte) error + type DatabaseReader interface + Get func(key []byte) (value []byte, err error) + type DeleteCallback func(types.Hash, uint64) + type HeaderChain struct + func NewHeaderChain(chainDb database.IDatabase, config *params.ChainConfig, ...) (*HeaderChain, error) + func (hc *HeaderChain) Config() *params.ChainConfig + func (hc *HeaderChain) CurrentHeader() *block.Header + func (hc *HeaderChain) Engine() consensus.Engine + func (hc *HeaderChain) GetBlock(hash types.Hash, number uint64) *block.Block + func (hc *HeaderChain) GetBlockHashesFromHash(hash types.Hash, max uint64) []types.Hash + func (hc *HeaderChain) GetBlockNumber(hash types.Hash) uint64 + func (hc *HeaderChain) GetHeader(hash types.Hash, number uint64) *block.Header + func (hc *HeaderChain) GetHeaderByHash(hash types.Hash) *block.Header + func (hc *HeaderChain) GetHeaderByNumber(number uint64) *block.Header + func (hc *HeaderChain) HasHeader(hash types.Hash, number uint64) bool + func (hc *HeaderChain) InsertHeaderChain(chain []*block.Header, writeHeader WhCallback, start time.Time) (int, error) + func (hc *HeaderChain) SetCurrentHeader(head *block.Header) + func (hc *HeaderChain) SetGenesis(head *block.Header) + func (hc *HeaderChain) SetHead(head uint64, delFn DeleteCallback) + func (hc *HeaderChain) ValidateHeaderChain(chain []*block.Header, checkFreq int) (int, error) + func (hc *HeaderChain) WriteHeader(header *block.Header) (status WriteStatus, err error) + type Processor interface + Process func(block *block.Block, statedb *state.StateDB, db database.IDatabaseGetter, ...) (transaction.Receipts, []*transaction.Log, error) + type TxLookupEntry struct + BlockHash types.Hash + BlockIndex uint64 + Index uint64 + func (z *TxLookupEntry) DecodeMsg(dc *msgp.Reader) (err error) + func (z *TxLookupEntry) EncodeMsg(en *msgp.Writer) (err error) + func (z *TxLookupEntry) MarshalMsg(b []byte) (o []byte, err error) + func (z *TxLookupEntry) Msgsize() (s int) + func (z *TxLookupEntry) UnmarshalMsg(bts []byte) (o []byte, err error) + type Validator interface + ValidateBody func(block *block.Block) error + ValidateState func(block, parent *block.Block, state *state.StateDB, ...) error + type WhCallback func(*block.Header) error + type WriteStatus byte + const CanonStatTy + const NonStatTy + const SideStatTy