6 "github.com/vapor/database/storage"
7 "github.com/vapor/protocol/bc"
8 "github.com/vapor/protocol/bc/types"
9 "github.com/vapor/protocol/state"
13 ErrNotFoundVoteResult = 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, uint64) bool
20 GetBlock(*bc.Hash, uint64) (*types.Block, error)
21 GetBlockHeader(*bc.Hash, uint64) (*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 GetVoteResult(uint64) (*state.VoteResult, error)
28 LoadBlockIndex(uint64) (*state.BlockIndex, error)
29 SaveBlock(*types.Block, *bc.TransactionStatus) error
30 SaveBlockHeader(*types.BlockHeader) error
31 SaveChainStatus(*state.BlockNode, *state.BlockNode, *state.UtxoViewpoint, []*state.VoteResult) error
34 // BlockStoreState represents the core's db status
35 type BlockStoreState struct {
38 IrreversibleHeight uint64
39 IrreversibleHash *bc.Hash