Versions in this module Expand all Collapse all v1 v1.0.0 May 26, 2022 Changes in this version + const MsgNewTx + const MsgRemoveTx + var ErrBadBlock = errors.New("invalid block") + var ErrBadStateRoot = errors.New("invalid state merkle root") + var ErrBadTx = errors.New("invalid transaction") + var ErrDustTx = errors.New("transaction is dust tx") + var ErrPoolIsFull = errors.New("transaction pool reach the max number") + var ErrTransactionNotExist = errors.New("transaction are not existed in the mempool") + type Chain struct + func NewChain(store state.Store, txPool *TxPool, eventDispatcher *event.Dispatcher) (*Chain, error) + func NewChainWithOrphanManage(store state.Store, txPool *TxPool, manage *OrphanManage, ...) (*Chain, error) + func (c *Chain) AllValidators(blockHash *bc.Hash) ([]*state.Validator, error) + func (c *Chain) BestBlockHash() *bc.Hash + func (c *Chain) BestBlockHeader() *types.BlockHeader + func (c *Chain) BestBlockHeight() uint64 + func (c *Chain) BestChain() (uint64, bc.Hash) + func (c *Chain) BlockExist(hash *bc.Hash) bool + func (c *Chain) BlockWaiter(height uint64) <-chan struct{} + func (c *Chain) FinalizedHeight() uint64 + func (c *Chain) GetBlockByHash(hash *bc.Hash) (*types.Block, error) + func (c *Chain) GetBlockByHeight(height uint64) (*types.Block, error) + func (c *Chain) GetHeaderByHash(hash *bc.Hash) (*types.BlockHeader, error) + func (c *Chain) GetHeaderByHeight(height uint64) (*types.BlockHeader, error) + func (c *Chain) GetTransactionsUtxo(view *state.UtxoViewpoint, txs []*bc.Tx) error + func (c *Chain) GetTxPool() *TxPool + func (c *Chain) GetValidator(prevHash *bc.Hash, timeStamp uint64) (*state.Validator, error) + func (c *Chain) InMainChain(hash bc.Hash) bool + func (c *Chain) LastFinalizedHeader() (*types.BlockHeader, error) + func (c *Chain) LastJustifiedHeader() (*types.BlockHeader, error) + func (c *Chain) PrevCheckpointByPrevHash(preBlockHash *bc.Hash) (*state.Checkpoint, error) + func (c *Chain) ProcessBlock(block *types.Block) (bool, error) + func (c *Chain) ProcessBlockVerification(v *casper.ValidCasperSignMsg) error + func (c *Chain) ProgramConverter(prog []byte) ([]byte, error) + func (c *Chain) SignBlockHeader(blockHeader *types.BlockHeader) + func (c *Chain) ValidateTx(tx *types.Tx) (bool, error) + type OrphanBlock struct + func NewOrphanBlock(block *types.Block, expiration time.Time) *OrphanBlock + func (o *OrphanBlock) Equals(o1 *OrphanBlock) bool + type OrphanManage struct + func NewOrphanManage() *OrphanManage + func NewOrphanManageWithData(orphan map[bc.Hash]*OrphanBlock, prevOrphans map[bc.Hash][]*bc.Hash) *OrphanManage + func (o *OrphanManage) Add(block *types.Block) + func (o *OrphanManage) BlockExist(hash *bc.Hash) bool + func (o *OrphanManage) Delete(hash *bc.Hash) + func (o *OrphanManage) Equals(o1 *OrphanManage) bool + func (o *OrphanManage) Get(hash *bc.Hash) (*types.Block, bool) + func (o *OrphanManage) GetPrevOrphans(hash *bc.Hash) ([]*bc.Hash, bool) + type TxDesc struct + Added time.Time + Fee uint64 + Height uint64 + Tx *types.Tx + Weight uint64 + type TxMsgEvent struct + TxMsg *TxPoolMsg + type TxPool struct + func NewTxPool(store state.Store, dispatcher *event.Dispatcher) *TxPool + func (tp *TxPool) AddErrCache(txHash *bc.Hash, err error) + func (tp *TxPool) ExpireOrphan(now time.Time) + func (tp *TxPool) GetErrCache(txHash *bc.Hash) error + func (tp *TxPool) GetTransaction(txHash *bc.Hash) (*TxDesc, error) + func (tp *TxPool) GetTransactions() []*TxDesc + func (tp *TxPool) HaveTransaction(txHash *bc.Hash) bool + func (tp *TxPool) IsDust(tx *types.Tx) bool + func (tp *TxPool) IsTransactionInErrCache(txHash *bc.Hash) bool + func (tp *TxPool) IsTransactionInPool(txHash *bc.Hash) bool + func (tp *TxPool) ProcessTransaction(tx *types.Tx, height, fee uint64) (bool, error) + func (tp *TxPool) RemoveTransaction(txHash *bc.Hash) + type TxPoolMsg struct + MsgType int