Documentation ¶
Index ¶
- type Chain
- func (chain *Chain) ApplyBlock(block *ngtypes.Block) error
- func (chain *Chain) CheckBlock(block *ngtypes.Block) error
- func (chain *Chain) CheckHealth(network ngtypes.Network)
- func (chain *Chain) ForceApplyBlocks(blocks []*ngtypes.Block) error
- func (chain *Chain) GetBlockByHash(hash []byte) (*ngtypes.Block, error)
- func (chain *Chain) GetBlockByHeight(height uint64) (*ngtypes.Block, error)
- func (chain *Chain) GetLatestBlock() *ngtypes.Block
- func (chain *Chain) GetLatestBlockHash() []byte
- func (chain *Chain) GetLatestBlockHeight() uint64
- func (chain *Chain) GetLatestCheckpoint() *ngtypes.Block
- func (chain *Chain) GetLatestCheckpointHash() []byte
- func (chain *Chain) GetOriginBlock() *ngtypes.Block
- func (chain *Chain) GetTxByHash(hash []byte) (*ngtypes.Tx, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
func (*Chain) ApplyBlock ¶
ApplyBlock checks the block and then calls blockchain's PutNewBlock, and then auto-upgrade the state.
func (*Chain) CheckBlock ¶
CheckBlock checks block before putting into chain.
func (*Chain) CheckHealth ¶
func (*Chain) ForceApplyBlocks ¶
ForceApplyBlocks simply checks the block and then calls chain.ForcePutNewBlock but **do not** upgrade the state. so, after this, dev should do a regenerate or import latest sheet.
func (*Chain) GetBlockByHash ¶
GetBlockByHash returns a block by hash inputted.
func (*Chain) GetBlockByHeight ¶
GetBlockByHeight returns a block by height inputted.
func (*Chain) GetLatestBlock ¶
GetLatestBlock will return the latest Block in DB.
func (*Chain) GetLatestBlockHash ¶
GetLatestBlockHash will fetch the latest block from chain and then calc its hash.
func (*Chain) GetLatestBlockHeight ¶
GetLatestBlockHeight will fetch the latest block from chain and then return its height.
func (*Chain) GetLatestCheckpoint ¶
GetLatestCheckpoint returns the latest checkpoint block.
func (*Chain) GetLatestCheckpointHash ¶
GetLatestCheckpointHash returns the hash of latest checkpoint.
func (*Chain) GetOriginBlock ¶
GetOriginBlock returns the genesis block for strict node, but can be any checkpoint for other node.