Documentation ¶
Index ¶
- Constants
- func GetNewEpoch(chain core.BlockChain) *big.Int
- type Environment
- type Worker
- func (w *Worker) ApplyShardReduction()
- func (w *Worker) CollectVerifiedSlashes() error
- func (w *Worker) CommitReceipts(receiptsList []*types.CXReceiptsProof) error
- func (w *Worker) CommitSortedTransactions(txs *types.TransactionsByPriceAndNonce, coinbase common.Address)
- func (w *Worker) CommitTransactions(pendingNormal map[common.Address]types.Transactions, ...) error
- func (w *Worker) FinalizeNewBlock(commitSigs chan []byte, viewID func() uint64, coinbase common.Address, ...) (*types.Block, error)
- func (w *Worker) GasCeil() uint64
- func (w *Worker) GasFloor(epoch *big.Int) uint64
- func (w *Worker) GetCurrentHeader() *block.Header
- func (w *Worker) GetCurrentReceipts() []*types.Receipt
- func (w *Worker) GetCurrentResult() *core.ProcessorResult
- func (w *Worker) GetCurrentState() *state.DB
- func (w *Worker) UpdateCurrent() (Environment, error)
Constants ¶
const CommitSigReceiverTimeout = 8 * time.Second
CommitSigReceiverTimeout is the timeout for the receiving side of the commit sig if timeout, the receiver should instead ready directly from db for the commit sig
Variables ¶
This section is empty.
Functions ¶
func GetNewEpoch ¶
func GetNewEpoch(chain core.BlockChain) *big.Int
GetNewEpoch gets the current epoch.
Types ¶
type Environment ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker is the main object which takes care of submitting new work to consensus engine and gathering the sealing result.
func New ¶
func New( chain core.BlockChain, beacon core.BlockChain, ) *Worker
New create a new worker object.
func (*Worker) ApplyShardReduction ¶
func (w *Worker) ApplyShardReduction()
ApplyShardReduction only used to reduce shards of Testnet
func (*Worker) CollectVerifiedSlashes ¶
CollectVerifiedSlashes sets w.current.slashes only to those that past verification
func (*Worker) CommitReceipts ¶
func (w *Worker) CommitReceipts(receiptsList []*types.CXReceiptsProof) error
CommitReceipts commits a list of already verified incoming cross shard receipts
func (*Worker) CommitSortedTransactions ¶
func (w *Worker) CommitSortedTransactions( txs *types.TransactionsByPriceAndNonce, coinbase common.Address, )
CommitSortedTransactions commits transactions for new block.
func (*Worker) CommitTransactions ¶
func (w *Worker) CommitTransactions( pendingNormal map[common.Address]types.Transactions, pendingStaking staking.StakingTransactions, coinbase common.Address, ) error
CommitTransactions commits transactions for new block.
func (*Worker) FinalizeNewBlock ¶
func (w *Worker) FinalizeNewBlock( commitSigs chan []byte, viewID func() uint64, coinbase common.Address, crossLinks types.CrossLinks, shardState *shard.State, ) (*types.Block, error)
FinalizeNewBlock generate a new block for the next consensus round.
func (*Worker) GetCurrentHeader ¶
GetCurrentHeader returns the current header to propose
func (*Worker) GetCurrentReceipts ¶
GetCurrentReceipts get the receipts generated starting from the last state.
func (*Worker) GetCurrentResult ¶
func (w *Worker) GetCurrentResult() *core.ProcessorResult
GetCurrentResult gets the current block processing result.
func (*Worker) GetCurrentState ¶
GetCurrentState gets the current state.
func (*Worker) UpdateCurrent ¶
func (w *Worker) UpdateCurrent() (Environment, error)
UpdateCurrent updates the current environment with the current state and header.