github.com/Bytom/bytom@v1.1.2-0.20210127130405-ae40204c0b09/protocol/store.go (about) 1 package protocol 2 3 import ( 4 "github.com/bytom/bytom/database/storage" 5 "github.com/bytom/bytom/protocol/bc" 6 "github.com/bytom/bytom/protocol/bc/types" 7 "github.com/bytom/bytom/protocol/state" 8 ) 9 10 // Store provides storage interface for blockchain data 11 type Store interface { 12 BlockExist(*bc.Hash) bool 13 14 GetBlock(*bc.Hash) (*types.Block, error) 15 GetStoreStatus() *BlockStoreState 16 GetTransactionStatus(*bc.Hash) (*bc.TransactionStatus, error) 17 GetTransactionsUtxo(*state.UtxoViewpoint, []*bc.Tx) error 18 GetUtxo(*bc.Hash) (*storage.UtxoEntry, error) 19 20 LoadBlockIndex(uint64) (*state.BlockIndex, error) 21 SaveBlock(*types.Block, *bc.TransactionStatus) error 22 SaveChainStatus(*state.BlockNode, *state.UtxoViewpoint) error 23 } 24 25 // BlockStoreState represents the core's db status 26 type BlockStoreState struct { 27 Height uint64 28 Hash *bc.Hash 29 }