Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestMiner ¶
Types ¶
type MineReq ¶ added in v0.5.0
type MineReq struct { InjectNulls abi.ChainEpoch Done func(bool, abi.ChainEpoch, error) }
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
Miner encapsulates the mining processes of the system.
Refer to the godocs on mineOne and mine methods for more detail.
func NewMiner ¶
func NewMiner(api api.FullNode, epp gen.WinningPoStProver, addr address.Address, sf *slashfilter.SlashFilter, j journal.Journal) *Miner
NewMiner instantiates a miner with a concrete WinningPoStProver and a miner address (which can be different from the worker's address).
func (*Miner) Address ¶ added in v0.3.0
func (m *Miner) Address() address.Address
Address returns the address of the miner.
func (*Miner) GetBestMiningCandidate ¶
func (m *Miner) GetBestMiningCandidate(ctx context.Context) (*MiningBase, error)
GetBestMiningCandidate implements the fork choice rule from a miner's perspective.
It obtains the current chain head (HEAD), and compares it to the last tipset we selected as our mining base (LAST). If HEAD's weight is larger than LAST's weight, it selects HEAD to build on. Else, it selects LAST.
type MiningBase ¶
type MiningBase struct { TipSet *types.TipSet NullRounds abi.ChainEpoch }
MiningBase is the tipset on top of which we plan to construct our next block. Refer to godocs on GetBestMiningCandidate.