Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGasLimitReached ¶
IsGasLimitReached block if full of txs.
func IsTxNotAdoptableNow ¶
IsTxNotAdoptableNow tx can not be adopted now.
Types ¶
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
Flow the flow of packing a new block.
func (*Flow) Adopt ¶
func (f *Flow) Adopt(tx *tx.Transaction) error
Adopt try to execute the given transaction. If the tx is valid and can be executed on current state (regardless of VM error), it will be adopted by the new block.
func (*Flow) Pack ¶
func (f *Flow) Pack(privateKey *ecdsa.PrivateKey, newBlockConflicts uint32) (*block.Block, *state.Stage, tx.Receipts, error)
Pack build and sign the new block.
func (*Flow) ParentHeader ¶
ParentHeader returns parent block header.
func (*Flow) TotalScore ¶
TotalScore returns total score of new block.
type Packer ¶
type Packer struct {
// contains filtered or unexported fields
}
Packer to pack txs and build new blocks.
func New ¶
func New( repo *chain.Repository, stater *state.Stater, nodeMaster workshare.Address, beneficiary *workshare.Address, forkConfig workshare.ForkConfig) *Packer
New create a new Packer instance. The beneficiary is optional, it defaults to endorsor if not set.
func (*Packer) Mock ¶
func (p *Packer) Mock(parent *chain.BlockSummary, targetTime uint64, gasLimit uint64) (*Flow, error)
Mock create a packing flow upon given parent, but with a designated timestamp. It will skip the PoA verification and scheduling, and the block produced by the returned flow is not in consensus.
func (*Packer) Schedule ¶
Schedule schedule a packing flow to pack new block upon given parent and clock time.
func (*Packer) SetTargetGasLimit ¶
SetTargetGasLimit set target gas limit, the Packer will adjust block gas limit close to it as it can.