Documentation ¶
Index ¶
- Variables
- func ConnectBlock(hs component.ICompSyncRequester, block *types.Block, ...) error
- func FetchTXs(hs component.ICompSyncRequester, maxBlockBodySize uint32) []*types.Tx
- func GatherTXs(hs component.ICompSyncRequester, bState *state.BlockState, txOp TxOp, ...) ([]*types.Tx, error)
- func GenerateBlock(hs component.ICompSyncRequester, prevBlock *types.Block, ...) (*types.Block, error)
- func GetBestBlock(hs component.ICompSyncRequester) *types.Block
- func LockChain() error
- func MaxBlockBodySize() uint32
- func UnlockChain()
- type ErrBlockConnect
- type ErrTimeout
- type TxOp
- type TxOpFn
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBestBlock indicates that the best block is being changed in // chainservice soon. ErrBestBlock = errors.New("best block changed in chainservice") )
var ( // ErrQuit indicates that shutdown is initiated. ErrQuit = errors.New("shutdown initiated") )
Functions ¶
func ConnectBlock ¶
func ConnectBlock(hs component.ICompSyncRequester, block *types.Block, blockState *state.BlockState) error
ConnectBlock send an AddBlock request to the chain service.
func FetchTXs ¶
func FetchTXs(hs component.ICompSyncRequester, maxBlockBodySize uint32) []*types.Tx
FetchTXs requests to mempool and returns types.Tx array.
func GatherTXs ¶
func GatherTXs(hs component.ICompSyncRequester, bState *state.BlockState, txOp TxOp, maxBlockBodySize uint32) ([]*types.Tx, error)
GatherTXs returns transactions from txIn. The selection is done by applying txDo.
func GenerateBlock ¶
func GenerateBlock(hs component.ICompSyncRequester, prevBlock *types.Block, bState *state.BlockState, txOp TxOp, ts int64) (*types.Block, error)
GenerateBlock generate & return a new block
func GetBestBlock ¶
func GetBestBlock(hs component.ICompSyncRequester) *types.Block
GetBestBlock returns the current best block from chainservice
func LockChain ¶ added in v0.9.4
func LockChain() error
LockChain aquires the chain lock in a non-blocking mode.
func MaxBlockBodySize ¶
func MaxBlockBodySize() uint32
MaxBlockBodySize returns the maximum block body size.
TODO: This is not an exact size. Let's make it exact!
Types ¶
type ErrBlockConnect ¶
type ErrBlockConnect struct {
// contains filtered or unexported fields
}
ErrBlockConnect indicates a error indicating a failed block connected request.
func (ErrBlockConnect) Error ¶
func (e ErrBlockConnect) Error() string
type ErrTimeout ¶
ErrTimeout can be used to indicatefor any kind of timeout.
func (ErrTimeout) Error ¶
func (e ErrTimeout) Error() string
type TxOp ¶
type TxOp interface {
Apply(bState *state.BlockState, tx *types.Tx) error
}
TxOp is an interface used by GatherTXs for apply some transaction related operation.
func NewCompTxOp ¶
NewCompTxOp returns a function which applies each function in fn.