Documentation ¶
Index ¶
- Variables
- func GenesisHeader(networkId config.Network) *types.Header
- func RegisterAPI(chain *BlockChain)
- type API
- func (a *API) CurrentBlock() *types.Block
- func (a *API) CurrentHeight() uint64
- func (a *API) CurrentTD() *big.Int
- func (a *API) GetBlockByHash(hash types.Hash) *types.Block
- func (a *API) GetBlockByHeight(height uint64) *types.Block
- func (a *API) GetBlockHashByHeight(height uint64) types.Hash
- func (a *API) GetBlockTD(hash types.Hash) *big.Int
- func (a *API) GetTransactionByHash(hash types.Hash) *RpcTransaction
- func (a *API) GetTransactionReceipt(hash types.Hash) *types.StoredReceipt
- type BlockChain
- func (bc *BlockChain) ApplyBlock(block *types.Block) error
- func (bc *BlockChain) ApplyHeaderChain(hc *HeaderChain) error
- func (bc *BlockChain) BlockByHeight(height uint64) *types.Block
- func (bc *BlockChain) Close()
- func (bc *BlockChain) GetBlock(height uint64, hash types.Hash) *types.Block
- func (bc *BlockChain) GetTd() *big.Int
- func (bc *BlockChain) HasBlock(height uint64, hash types.Hash) bool
- func (bc *BlockChain) LatestBlock() *types.Block
- func (bc *BlockChain) LatestState() (*iavl.ImmutableTree, error)
- func (bc *BlockChain) NewHeaderChain() *HeaderChain
- func (bc *BlockChain) Simulate(txs types.Txs) (*transactor.ExecutionResult, error)
- type GetBlockByMinerData
- type GetBlockByMinerParam
- type HeaderChain
- type RpcTransaction
- type SubAPI
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnknownAncestor is returned when validating a block requires an ancestor // that is unknown. ErrUnknownAncestor = errors.New("unknown ancestor") // ErrFutureBlock is returned when a block's timestamp is in the future according // to the current node. ErrFutureBlock = errors.New("block in the future") )
Functions ¶
func RegisterAPI ¶
func RegisterAPI(chain *BlockChain)
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) CurrentBlock ¶
func (*API) CurrentHeight ¶
func (*API) GetTransactionByHash ¶
func (a *API) GetTransactionByHash(hash types.Hash) *RpcTransaction
func (*API) GetTransactionReceipt ¶
func (a *API) GetTransactionReceipt(hash types.Hash) *types.StoredReceipt
type BlockChain ¶
func NewBlockChain ¶
func NewBlockChain(logger log.Logger) (*BlockChain, error)
func (*BlockChain) ApplyBlock ¶
func (bc *BlockChain) ApplyBlock(block *types.Block) error
func (*BlockChain) ApplyHeaderChain ¶
func (bc *BlockChain) ApplyHeaderChain(hc *HeaderChain) error
func (*BlockChain) BlockByHeight ¶
func (bc *BlockChain) BlockByHeight(height uint64) *types.Block
func (*BlockChain) Close ¶
func (bc *BlockChain) Close()
func (*BlockChain) GetTd ¶
func (bc *BlockChain) GetTd() *big.Int
func (*BlockChain) LatestBlock ¶
func (bc *BlockChain) LatestBlock() *types.Block
LatestBlock retrieves the latest head block of the canonical chain. The block is retrieved from the blockchain's internal cache.
func (*BlockChain) LatestState ¶
func (bc *BlockChain) LatestState() (*iavl.ImmutableTree, error)
func (*BlockChain) NewHeaderChain ¶
func (bc *BlockChain) NewHeaderChain() *HeaderChain
func (*BlockChain) Simulate ¶
func (bc *BlockChain) Simulate(txs types.Txs) (*transactor.ExecutionResult, error)
type GetBlockByMinerData ¶ added in v0.1.0
type GetBlockByMinerParam ¶ added in v0.1.0
type HeaderChain ¶
used to store a sort of contiguous block headers for later applying
func (*HeaderChain) AppendBlocks ¶
func (hc *HeaderChain) AppendBlocks(blocks []*types.Block) error
append blocks to calculate total difficulty, only contiguous and valid blocks are included
func (*HeaderChain) CanStartFrom ¶
func (hc *HeaderChain) CanStartFrom(height uint64, hash types.Hash) bool
func (*HeaderChain) GetTd ¶
func (hc *HeaderChain) GetTd() *big.Int
type RpcTransaction ¶ added in v0.0.3
type SubAPI ¶
type SubAPI struct {
// contains filtered or unexported fields
}
func (*SubAPI) NewHeads ¶
NewHeads send a notification each time a new (header) block is appended to the chain.
func (*SubAPI) NewTransactions ¶
NewTransactions send a notification each time a new (header) block is appended to the chain.
Click to show internal directories.
Click to hide internal directories.