Documentation
¶
Index ¶
- Variables
- func CalcBlockHashesKey(height uint64) []byte
- func CalcBlockHeaderKey(hash *bc.Hash) []byte
- func CalcBlockTransactionsKey(hash *bc.Hash) []byte
- func CalcContractKey(hash [32]byte) []byte
- func CalcUtxoKey(hash *bc.Hash) []byte
- func GetBlockHashesByHeight(db dbm.DB, height uint64) ([]*bc.Hash, error)
- func GetBlockHeader(db dbm.DB, hash *bc.Hash) (*types.BlockHeader, error)
- func GetBlockTransactions(db dbm.DB, hash *bc.Hash) ([]*types.Tx, error)
- func GetMainChainHash(db dbm.DB, height uint64) (*bc.Hash, error)
- func SaveUtxoView(batch dbm.Batch, view *state.UtxoViewpoint) error
- type Store
- func (s *Store) BlockExist(hash *bc.Hash) bool
- func (s *Store) CheckpointsFromNode(height uint64, hash *bc.Hash) ([]*state.Checkpoint, error)
- func (s *Store) GetBlock(hash *bc.Hash) (*types.Block, error)
- func (s *Store) GetBlockHashesByHeight(height uint64) ([]*bc.Hash, error)
- func (s *Store) GetBlockHeader(hash *bc.Hash) (*types.BlockHeader, error)
- func (s *Store) GetBlockTransactions(hash *bc.Hash) ([]*types.Tx, error)
- func (s *Store) GetCheckpoint(hash *bc.Hash) (*state.Checkpoint, error)
- func (s *Store) GetCheckpointsByHeight(height uint64) ([]*state.Checkpoint, error)
- func (s *Store) GetContract(hash [32]byte) ([]byte, error)
- func (s *Store) GetMainChainHash(height uint64) (*bc.Hash, error)
- func (s *Store) GetStoreStatus() *state.BlockStoreState
- func (s *Store) GetTransactionsUtxo(view *state.UtxoViewpoint, txs []*bc.Tx) error
- func (s *Store) GetUtxo(hash *bc.Hash) (*storage.UtxoEntry, error)
- func (s *Store) SaveBlock(block *types.Block) error
- func (s *Store) SaveBlockHeader(blockHeader *types.BlockHeader) error
- func (s *Store) SaveChainStatus(blockHeader *types.BlockHeader, mainBlockHeaders []*types.BlockHeader, ...) error
- func (s *Store) SaveCheckpoints(checkpoints []*state.Checkpoint) error
Constants ¶
This section is empty.
Variables ¶
var ( // BlockHashesKeyPrefix key Prefix BlockHashesKeyPrefix = []byte{blockHashes, colon} UtxoKeyPrefix = []byte{utxo, colon} ContractPrefix = []byte{contract, colon} )
var ( // BlockStoreKey block store key BlockStoreKey = []byte("blockStore") )
Functions ¶
func CalcBlockHashesKey ¶
CalcBlockHashesKey make up hashes key with prefix + height
func CalcBlockHeaderKey ¶
CalcBlockHeaderKey make up header key with prefix + hash
func CalcBlockTransactionsKey ¶
CalcBlockTransactionsKey make up txs key with prefix + hash
func CalcContractKey ¶
CalcContractKey calculate contract key
func CalcUtxoKey ¶
func GetBlockHashesByHeight ¶
GetBlockHashesByHeight return block hashes by given height
func GetBlockHeader ¶
GetBlockHeader return the block header by given hash
func GetBlockTransactions ¶
GetBlockTransactions return the block transactions by given hash
func GetMainChainHash ¶
GetMainChainHash return BlockHash by given height
func SaveUtxoView ¶
func SaveUtxoView(batch dbm.Batch, view *state.UtxoViewpoint) error
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
A Store encapsulates storage for blockchain validation. It satisfies the interface protocol.Store, and provides additional methods for querying current data.
func (*Store) BlockExist ¶
BlockExist check if the block is stored in disk
func (*Store) CheckpointsFromNode ¶
CheckpointsFromNode return all checkpoints from specified block height and hash
func (*Store) GetBlockHashesByHeight ¶
GetBlockHashesByHeight return the block hash by the specified height
func (*Store) GetBlockHeader ¶
GetBlockHeader return the BlockHeader by given hash
func (*Store) GetBlockTransactions ¶
GetBlockTransactions return the Block transactions by given hash
func (*Store) GetCheckpoint ¶
func (*Store) GetCheckpointsByHeight ¶
func (s *Store) GetCheckpointsByHeight(height uint64) ([]*state.Checkpoint, error)
GetCheckpointsByHeight return all checkpoints of specified block height
func (*Store) GetMainChainHash ¶
GetMainChainHash return the block hash by the specified height
func (*Store) GetStoreStatus ¶
func (s *Store) GetStoreStatus() *state.BlockStoreState
GetStoreStatus return the BlockStoreStateJSON
func (*Store) GetTransactionsUtxo ¶
GetTransactionsUtxo will return all the utxo that related to the input txs
func (*Store) SaveBlockHeader ¶
func (s *Store) SaveBlockHeader(blockHeader *types.BlockHeader) error
SaveBlockHeader persists a new block header in the protocol.
func (*Store) SaveChainStatus ¶
func (s *Store) SaveChainStatus(blockHeader *types.BlockHeader, mainBlockHeaders []*types.BlockHeader, view *state.UtxoViewpoint, contractView *state.ContractViewpoint, finalizedHeight uint64, finalizedHash *bc.Hash) error
SaveChainStatus save the core's newest status && delete old status
func (*Store) SaveCheckpoints ¶
func (s *Store) SaveCheckpoints(checkpoints []*state.Checkpoint) error
SaveCheckpoints bulk save multiple checkpoint