6 "github.com/bytom/vapor/database/storage"
7 "github.com/bytom/vapor/protocol/bc"
8 "github.com/bytom/vapor/protocol/bc/types"
9 "github.com/bytom/vapor/protocol/state"
13 ErrNotFoundConsensusResult = errors.New("can't find the vote result by given sequence")
16 // Store provides storage interface for blockchain data
17 type Store interface {
18 BlockExist(*bc.Hash) bool
20 GetBlock(*bc.Hash) (*types.Block, error)
21 GetBlockHeader(*bc.Hash) (*types.BlockHeader, error)
22 GetStoreStatus() *BlockStoreState
23 GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error)
24 GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error
25 GetUtxo(*bc.Hash) (*storage.UtxoEntry, error)
26 GetConsensusResult(uint64) (*state.ConsensusResult, error)
27 GetMainChainHash(uint64) (*bc.Hash, error)
28 GetBlockHashesByHeight(uint64) ([]*bc.Hash, error)
30 DeleteConsensusResult(uint64) error
31 DeleteBlock(*types.Block) error
32 SaveBlock(*types.Block, *bc.TransactionStatus) error
33 SaveBlockHeader(*types.BlockHeader) error
34 SaveChainStatus(*types.BlockHeader, *types.BlockHeader, []*types.BlockHeader, *state.UtxoViewpoint, []*state.ConsensusResult) error
37 // BlockStoreState represents the core's db status
38 type BlockStoreState struct {
41 IrreversibleHeight uint64
42 IrreversibleHash *bc.Hash