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"
14 ErrNotFoundConsensusResult = errors.New("can't find the vote result by given sequence")
17 // Store provides storage interface for blockchain data
18 type Store interface {
19 BlockExist(*bc.Hash) bool
21 GetBlock(*bc.Hash) (*types.Block, error)
22 GetBlockHeader(*bc.Hash) (*types.BlockHeader, error)
23 GetStoreStatus() *BlockStoreState
24 GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error)
25 GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error
26 GetUtxo(*bc.Hash) (*storage.UtxoEntry, error)
27 GetConsensusResult(uint64) (*state.ConsensusResult, error)
28 GetMainChainHash(uint64) (*bc.Hash, error)
29 GetBlockHashesByHeight(uint64) ([]*bc.Hash, error)
31 DeleteConsensusResult(uint64) error
32 DeleteBlock(*types.Block) error
33 SaveBlock(*types.Block, *bc.TransactionStatus) error
34 SaveBlockHeader(*types.BlockHeader) error
35 SaveChainStatus(*types.BlockHeader, *types.BlockHeader, []*types.BlockHeader, *state.UtxoViewpoint, []*state.ConsensusResult) error
38 // BlockStoreState represents the core's db status
39 type BlockStoreState struct {
42 IrreversibleHeight uint64
43 IrreversibleHash *bc.Hash