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 SaveBlock(*types.Block, *bc.TransactionStatus) error
31 SaveBlockHeader(*types.BlockHeader) error
32 SaveChainStatus(*types.BlockHeader, *types.BlockHeader, []*types.BlockHeader, *state.UtxoViewpoint, []*state.ConsensusResult) error
35 // BlockStoreState represents the core's db status
36 type BlockStoreState struct {
39 IrreversibleHeight uint64
40 IrreversibleHash *bc.Hash