X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=protocol%2Fstore.go;h=d2d11265a08072d1efa46212fdd0ab0754f3bb85;hb=b8a7a38c80cc928749666f1b1d03a5477c26be0d;hp=915d0675f31c5ed5267118be47ffa0b527220076;hpb=cc968002ceac2dfd7665c2ac2b4c32ab6017b525;p=bytom%2Fvapor.git diff --git a/protocol/store.go b/protocol/store.go index 915d0675..d2d11265 100644 --- a/protocol/store.go +++ b/protocol/store.go @@ -1,12 +1,18 @@ package protocol import ( + "errors" + "github.com/vapor/database/storage" "github.com/vapor/protocol/bc" "github.com/vapor/protocol/bc/types" "github.com/vapor/protocol/state" ) +var ( + ErrNotFoundVoteResult = errors.New("can't find the vote result by given sequence") +) + // Store provides storage interface for blockchain data type Store interface { BlockExist(*bc.Hash) bool @@ -16,20 +22,18 @@ type Store interface { GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error) GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error GetUtxo(*bc.Hash) (*storage.UtxoEntry, error) + GetVoteResult(uint64) (*state.VoteResult, error) LoadBlockIndex(uint64) (*state.BlockIndex, error) SaveBlock(*types.Block, *bc.TransactionStatus) error - SaveChainStatus(*state.BlockNode, *state.UtxoViewpoint) error - - IsWithdrawSpent(hash *bc.Hash) bool - SetWithdrawSpent(hash *bc.Hash) - - Set(hash *bc.Hash, data []byte) error - Get(hash *bc.Hash) ([]byte, error) + SaveChainStatus(*state.BlockNode, *state.BlockNode, *state.UtxoViewpoint, []*state.VoteResult) error + SaveChainNodeStatus(*state.BlockNode, *state.BlockNode) error } // BlockStoreState represents the core's db status type BlockStoreState struct { - Height uint64 - Hash *bc.Hash + Height uint64 + Hash *bc.Hash + IrreversibleHeight uint64 + IrreversibleHash *bc.Hash }