Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteBlock(db DatabaseDeleter, hash common.Hash)
- func DeleteBlockChilds(db DatabaseDeleter, hash common.Hash)
- func DeleteBloomBits(db DatabaseDeleter, bit uint, section uint64) error
- func DeleteHashList(db DatabaseDeleter, round uint64)
- func DeletePkgPoolHashList(db DatabaseDeleter)
- func DeleteReceipts(db DatabaseDeleter, hash common.Hash)
- func FindReorgChain(db DatabaseReader, old, new *types.BlockHeader) []*types.BlockHeader
- func HasBlock(db DatabaseReader, hash common.Hash) bool
- func HasTxPkg(db DatabaseReader, hash common.Hash) bool
- func ReadBlockBody(db DatabaseReader, hash common.Hash) *types.BlockBody
- func ReadBlockBodyRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
- func ReadBlockChilds(db DatabaseReader, hash common.Hash) []common.Hash
- func ReadBlockHeader(db DatabaseReader, hash common.Hash) *types.BlockHeader
- func ReadBlockHeaderRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
- func ReadBlockReceivePath(db DatabaseReader, hash common.Hash) (types.BlockReceivePathEnum, error)
- func ReadBlockStateCheck(db DatabaseReader, hash common.Hash) types.BlockStateCheckedEnum
- func ReadBloom(db DatabaseReader, hash common.Hash) (*types.Bloom, error)
- func ReadBloomBits(db DatabaseReader, bit uint, section uint64) ([]byte, error)
- func ReadBloomFastSyncReachHeight(db DatabaseReader) (uint64, error)
- func ReadBloomRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
- func ReadBloomSectionSavedFlag(db DatabaseReader, section uint64) bool
- func ReadChainConfig(db DatabaseReader) ([]byte, error)
- func ReadDatabaseVersion(db DatabaseReader) int
- func ReadGenesisBlockHash(db DatabaseReader) common.Hash
- func ReadHashListByBlockBackward(db DatabaseReader, b *types.Block, num uint64) []*types.BlockRoundHash
- func ReadHashListByBlockRange(db DatabaseReader, b1 *types.Block, b2 *types.Block) []*types.BlockRoundHash
- func ReadHashListByRound(db DatabaseReader, round uint64) types.BlockRoundHashes
- func ReadHashListByRoundRange(db DatabaseReader, r1 uint64, r2 uint64) []*types.BlockRoundHash
- func ReadHeadBlockHash(db DatabaseReader) common.Hash
- func ReadHeightBlockMap(db DatabaseReader, height uint64) (common.Hash, error)
- func ReadHeightBlocks(db DatabaseReader, height uint64) ([]common.Hash, error)
- func ReadMainBranchHeadHeightAndHash(db DatabaseReader) (uint64, common.Hash, error)
- func ReadPackerNonce(db DatabaseReader, coinbase common.Address) (uint64, error)
- func ReadPkgPoolHashList(db DatabaseReader) ([]common.Hash, error)
- func ReadReceipts(db DatabaseReader, hash common.Hash) types.Receipts
- func ReadReceiptsRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
- func ReadTxLookupEntryRLP(db DatabaseReader, hash common.Hash) (rlp.RawValue, error)
- func ReadTxPkg(db DatabaseReader, hash common.Hash) (*types.TxPackage, error)
- func ReadTxPkgRLP(db DatabaseReader, hash common.Hash) (rlp.RawValue, error)
- func ReadTxSavedBlockHeightAndHash(db DatabaseReader) (uint64, common.Hash, error)
- func WriteBlock(db DatabaseWriter, block *types.Block)
- func WriteBlockChilds(db DatabaseWriter, hash common.Hash, childs []common.Hash)
- func WriteBlockStateCheck(db DatabaseWriter, hash common.Hash, value types.BlockStateCheckedEnum)
- func WriteBloom(db DatabaseWriter, hash common.Hash, bloom *types.Bloom)
- func WriteBloomBits(db DatabaseWriter, bit uint, section uint64, bits []byte)
- func WriteBloomFastSyncReachHeight(db DatabaseWriter, height uint64)
- func WriteBloomSectionSavedFlag(db DatabaseWriter, section uint64, flag bool)
- func WriteChainConfig(db DatabaseWriter, data []byte) error
- func WriteDatabaseVersion(db DatabaseWriter, version int)
- func WriteGenesisBlockHash(db DatabaseWriter, hash common.Hash)
- func WriteHashList(db DatabaseWriter, round uint64, hashList []*types.BlockRoundHash)
- func WriteHeadBlockHash(db DatabaseWriter, hash common.Hash)
- func WriteHeightBlockMap(db DatabaseWriter, height uint64, blockFullHash common.Hash)
- func WriteHeightBlocks(db DatabaseWriter, height uint64, hashes []common.Hash)
- func WriteMainBranchHeadHeightAndHash(db DatabaseWriter, height uint64, hash common.Hash)
- func WritePackerNonce(db DatabaseWriter, coinbase common.Address, nonce uint64)
- func WritePkgPoolHashList(db DatabaseWriter, hashList []common.Hash)
- func WriteReceipts(db DatabaseWriter, hash common.Hash, receipts types.Receipts)
- func WriteTxLookupEntries(db dbwrapper.Database, blockHeight uint64, blockFullHash common.Hash, ...)
- func WriteTxPkg(db DatabaseWriter, pkg *types.TxPackage)
- func WriteTxSavedBlockHeightAndHash(db DatabaseWriter, height uint64, hash common.Hash)
- type DatabaseDeleter
- type DatabaseReader
- type DatabaseWriter
- type TxLookupEntry
- type TxLookupList
Constants ¶
const (
RoundStep = 10
)
Variables ¶
var (
ErrDataLength = errors.New("data length error")
)
Functions ¶
func DeleteBlock ¶
func DeleteBlock(db DatabaseDeleter, hash common.Hash)
DeleteBlock removes all block data associated with a hash.
func DeleteBlockChilds ¶
func DeleteBlockChilds(db DatabaseDeleter, hash common.Hash)
DeleteBlockChilds removes the height to hash mapping.
func DeleteBloomBits ¶
func DeleteBloomBits(db DatabaseDeleter, bit uint, section uint64) error
func DeleteHashList ¶
func DeleteHashList(db DatabaseDeleter, round uint64)
DeleteHashList delete the hash assigned to a block round.
func DeletePkgPoolHashList ¶
func DeletePkgPoolHashList(db DatabaseDeleter)
func DeleteReceipts ¶
func DeleteReceipts(db DatabaseDeleter, hash common.Hash)
DeleteReceipts removes all receipt data associated with a block hash.
func FindReorgChain ¶
func FindReorgChain(db DatabaseReader, old, new *types.BlockHeader) []*types.BlockHeader
Return blocks of reorg chain, include common ancestor (the first element of the result slice is the common ancestor, and the last element of the result slice is the new header)
func HasBlock ¶
func HasBlock(db DatabaseReader, hash common.Hash) bool
HasBlock verifies the existence of a block header corresponding to the hash.
func HasTxPkg ¶
func HasTxPkg(db DatabaseReader, hash common.Hash) bool
HasTxPkg verifies the existence of a txpkg corresponding to the hash.
func ReadBlockBody ¶
func ReadBlockBody(db DatabaseReader, hash common.Hash) *types.BlockBody
ReadBlockBody retrieves the block corresponding to the hash.
func ReadBlockBodyRLP ¶
func ReadBlockBodyRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
ReadBlockBodyRLP retrieves a block body in its raw RLP database encoding.
func ReadBlockChilds ¶
func ReadBlockChilds(db DatabaseReader, hash common.Hash) []common.Hash
ReadBlockChilds returns the block childs assigned to a hash.
func ReadBlockHeader ¶
func ReadBlockHeader(db DatabaseReader, hash common.Hash) *types.BlockHeader
ReadBlockHeader retrieves the block corresponding to the hash.
func ReadBlockHeaderRLP ¶
func ReadBlockHeaderRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
ReadBlockHeaderRLP retrieves a block header in its raw RLP database encoding.
func ReadBlockReceivePath ¶
func ReadBlockReceivePath(db DatabaseReader, hash common.Hash) (types.BlockReceivePathEnum, error)
ReadBlockReceivePath retrieves the block corresponding to the hash.
func ReadBlockStateCheck ¶
func ReadBlockStateCheck(db DatabaseReader, hash common.Hash) types.BlockStateCheckedEnum
func ReadBloomBits ¶
func ReadBloomBits(db DatabaseReader, bit uint, section uint64) ([]byte, error)
ReadBloomBits retrieves the compressed bloom bit vector belonging to the given section and bit index from the.
func ReadBloomFastSyncReachHeight ¶
func ReadBloomFastSyncReachHeight(db DatabaseReader) (uint64, error)
func ReadBloomRLP ¶
func ReadBloomRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
func ReadBloomSectionSavedFlag ¶
func ReadBloomSectionSavedFlag(db DatabaseReader, section uint64) bool
func ReadChainConfig ¶
func ReadChainConfig(db DatabaseReader) ([]byte, error)
ReadChainConfig retrieves the chain config.
func ReadDatabaseVersion ¶
func ReadDatabaseVersion(db DatabaseReader) int
ReadDatabaseVersion retrieves the version number of the database.
func ReadGenesisBlockHash ¶
func ReadGenesisBlockHash(db DatabaseReader) common.Hash
ReadGenesisBlockHash retrieves the hash of the genesis block.
func ReadHashListByBlockBackward ¶
func ReadHashListByBlockBackward(db DatabaseReader, b *types.Block, num uint64) []*types.BlockRoundHash
ReadHashListByBlockBackward retrieves the hash older than the block b
func ReadHashListByBlockRange ¶
func ReadHashListByBlockRange(db DatabaseReader, b1 *types.Block, b2 *types.Block) []*types.BlockRoundHash
ReadHashListByBlockRange retrieves the hash assigned to a block range (b1, b2]
func ReadHashListByRound ¶
func ReadHashListByRound(db DatabaseReader, round uint64) types.BlockRoundHashes
ReadHashListByRound retrieves the hash assigned to a round step range(related to param round)
func ReadHashListByRoundRange ¶
func ReadHashListByRoundRange(db DatabaseReader, r1 uint64, r2 uint64) []*types.BlockRoundHash
ReadHashListByRoundRange retrieves the hash assigned to a round range (r1, r2]
func ReadHeadBlockHash ¶
func ReadHeadBlockHash(db DatabaseReader) common.Hash
ReadHeadBlockHash retrieves the hash of the current canonical head block.
func ReadHeightBlockMap ¶
func ReadHeightBlockMap(db DatabaseReader, height uint64) (common.Hash, error)
func ReadHeightBlocks ¶
func ReadHeightBlocks(db DatabaseReader, height uint64) ([]common.Hash, error)
func ReadMainBranchHeadHeightAndHash ¶
func ReadMainBranchHeadHeightAndHash(db DatabaseReader) (uint64, common.Hash, error)
func ReadPackerNonce ¶
func ReadPackerNonce(db DatabaseReader, coinbase common.Address) (uint64, error)
func ReadPkgPoolHashList ¶
func ReadPkgPoolHashList(db DatabaseReader) ([]common.Hash, error)
func ReadReceipts ¶
func ReadReceipts(db DatabaseReader, hash common.Hash) types.Receipts
ReadReceipts retrieves all the transaction receipts belonging to a block.
func ReadReceiptsRLP ¶
func ReadReceiptsRLP(db DatabaseReader, hash common.Hash) rlp.RawValue
func ReadTxLookupEntryRLP ¶
func ReadTxPkgRLP ¶
func ReadTxSavedBlockHeightAndHash ¶
func ReadTxSavedBlockHeightAndHash(db DatabaseReader) (uint64, common.Hash, error)
func WriteBlock ¶
func WriteBlock(db DatabaseWriter, block *types.Block)
WriteBlock stores a block header into the database
func WriteBlockChilds ¶
func WriteBlockChilds(db DatabaseWriter, hash common.Hash, childs []common.Hash)
WriteBlockChilds returns the block childs assigned to a hash.
func WriteBlockStateCheck ¶
func WriteBlockStateCheck(db DatabaseWriter, hash common.Hash, value types.BlockStateCheckedEnum)
WriteBlockStateCheck writes the state check enum into db.
func WriteBloom ¶
func WriteBloom(db DatabaseWriter, hash common.Hash, bloom *types.Bloom)
WriteReceipts stores the transaction bloom belonging to a block.
func WriteBloomBits ¶
func WriteBloomBits(db DatabaseWriter, bit uint, section uint64, bits []byte)
WriteBloomBits stores the compressed bloom bits vector belonging to the given section and bit index.
func WriteBloomFastSyncReachHeight ¶
func WriteBloomFastSyncReachHeight(db DatabaseWriter, height uint64)
func WriteBloomSectionSavedFlag ¶
func WriteBloomSectionSavedFlag(db DatabaseWriter, section uint64, flag bool)
func WriteChainConfig ¶
func WriteChainConfig(db DatabaseWriter, data []byte) error
WriteChainConfig writes the chain config.
func WriteDatabaseVersion ¶
func WriteDatabaseVersion(db DatabaseWriter, version int)
WriteDatabaseVersion stores the version number of the database
func WriteGenesisBlockHash ¶
func WriteGenesisBlockHash(db DatabaseWriter, hash common.Hash)
WriteGenesisBlockHash stores the genesis block's hash.
func WriteHashList ¶
func WriteHashList(db DatabaseWriter, round uint64, hashList []*types.BlockRoundHash)
WriteHashList stores the hash assigned to a block round.
func WriteHeadBlockHash ¶
func WriteHeadBlockHash(db DatabaseWriter, hash common.Hash)
WriteHeadBlockHash stores the head block's hash.
func WriteHeightBlockMap ¶
func WriteHeightBlockMap(db DatabaseWriter, height uint64, blockFullHash common.Hash)
func WriteHeightBlocks ¶
func WriteHeightBlocks(db DatabaseWriter, height uint64, hashes []common.Hash)
func WriteMainBranchHeadHeightAndHash ¶
func WriteMainBranchHeadHeightAndHash(db DatabaseWriter, height uint64, hash common.Hash)
func WritePackerNonce ¶
func WritePackerNonce(db DatabaseWriter, coinbase common.Address, nonce uint64)
func WritePkgPoolHashList ¶
func WritePkgPoolHashList(db DatabaseWriter, hashList []common.Hash)
WritePkgPoolHashList stores the pending pkgs in pkgPool.
func WriteReceipts ¶
func WriteReceipts(db DatabaseWriter, hash common.Hash, receipts types.Receipts)
WriteReceipts stores all the transaction receipts belonging to a block.
func WriteTxLookupEntries ¶
func WriteTxPkg ¶
func WriteTxPkg(db DatabaseWriter, pkg *types.TxPackage)
func WriteTxSavedBlockHeightAndHash ¶
func WriteTxSavedBlockHeightAndHash(db DatabaseWriter, height uint64, hash common.Hash)
Types ¶
type DatabaseDeleter ¶
DatabaseDeleter wraps the Delete method of a backing data store.
type DatabaseReader ¶
DatabaseReader wraps the Has and Get method of a backing data store.
type DatabaseWriter ¶
DatabaseWriter wraps the Put method of a backing data store.
type TxLookupEntry ¶
TxLookupEntry is a positional metadata to help looking up the data content of a transaction or receipt given only its hash.
func ReadTxLookupEntry ¶
func ReadTxLookupEntry(db DatabaseReader, hash common.Hash) (TxLookupEntry, error)
type TxLookupList ¶
type TxLookupList []TxLookupEntry