OSDN Git Service

rename (#465)
[bytom/vapor.git] / protocol / store.go
index 915d067..808b289 100644 (file)
@@ -1,10 +1,16 @@
 package protocol
 
 import (
-       "github.com/vapor/database/storage"
-       "github.com/vapor/protocol/bc"
-       "github.com/vapor/protocol/bc/types"
-       "github.com/vapor/protocol/state"
+       "errors"
+
+       "github.com/bytom/vapor/database/storage"
+       "github.com/bytom/vapor/protocol/bc"
+       "github.com/bytom/vapor/protocol/bc/types"
+       "github.com/bytom/vapor/protocol/state"
+)
+
+var (
+       ErrNotFoundConsensusResult = errors.New("can't find the vote result by given sequence")
 )
 
 // Store provides storage interface for blockchain data
@@ -12,24 +18,24 @@ type Store interface {
        BlockExist(*bc.Hash) bool
 
        GetBlock(*bc.Hash) (*types.Block, error)
+       GetBlockHeader(*bc.Hash) (*types.BlockHeader, error)
        GetStoreStatus() *BlockStoreState
        GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error)
        GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error
        GetUtxo(*bc.Hash) (*storage.UtxoEntry, error)
+       GetConsensusResult(uint64) (*state.ConsensusResult, error)
+       GetMainChainHash(uint64) (*bc.Hash, error)
+       GetBlockHashesByHeight(uint64) ([]*bc.Hash, 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)
+       SaveBlockHeader(*types.BlockHeader) error
+       SaveChainStatus(*types.BlockHeader, *types.BlockHeader, []*types.BlockHeader, *state.UtxoViewpoint, []*state.ConsensusResult) 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
 }