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 ¶ added in v1.2.1
CalcBlockHashesKey make up hashes key with prefix + height
func CalcBlockHeaderKey ¶ added in v1.0.10
CalcBlockHeaderKey make up header key with prefix + hash
func CalcBlockTransactionsKey ¶ added in v1.2.1
CalcBlockTransactionsKey make up txs key with prefix + hash
func CalcContractKey ¶ added in v1.2.1
CalcContractKey calculate contract key
func CalcUtxoKey ¶ added in v1.0.10
func GetBlockHashesByHeight ¶ added in v1.2.1
GetBlockHashesByHeight return block hashes by given height
func GetBlockHeader ¶ added in v1.2.1
GetBlockHeader return the block header by given hash
func GetBlockTransactions ¶ added in v1.2.1
GetBlockTransactions return the block transactions by given hash
func GetMainChainHash ¶ added in v1.2.1
GetMainChainHash return BlockHash by given height
func SaveUtxoView ¶ added in v1.0.9
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 ¶ added in v1.2.1
CheckpointsFromNode return all checkpoints from specified block height and hash
func (*Store) GetBlockHashesByHeight ¶ added in v1.2.1
GetBlockHashesByHeight return the block hash by the specified height
func (*Store) GetBlockHeader ¶
GetBlockHeader return the BlockHeader by given hash
func (*Store) GetBlockTransactions ¶ added in v1.2.1
GetBlockTransactions return the Block transactions by given hash
func (*Store) GetCheckpoint ¶ added in v1.2.1
func (*Store) GetCheckpointsByHeight ¶ added in v1.2.1
func (s *Store) GetCheckpointsByHeight(height uint64) ([]*state.Checkpoint, error)
GetCheckpointsByHeight return all checkpoints of specified block height
func (*Store) GetContract ¶ added in v1.2.1
func (*Store) GetMainChainHash ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (s *Store) SaveCheckpoints(checkpoints []*state.Checkpoint) error
SaveCheckpoints bulk save multiple checkpoint