miner

package
v1.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0, MIT Imports: 34 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestMiner

func NewTestMiner(nextCh <-chan MineReq, addr address.Address) func(v1api.FullNode, gen.WinningPoStProver) *Miner

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 v1api.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, returning the best head to mine on. This includes the number of null rounds we think we should insert and the time at which we received said head.

func (*Miner) Start added in v0.3.0

func (m *Miner) Start(_ context.Context) error

Start starts the mining operation. It spawns a goroutine and returns immediately. Start is not idempotent.

func (*Miner) Stop added in v0.3.0

func (m *Miner) Stop(ctx context.Context) error

Stop stops the mining operation. It is not idempotent, and multiple adjacent calls to Stop will fail.

type MiningBase

type MiningBase struct {
	TipSet      *types.TipSet
	ComputeTime time.Time
	NullRounds  abi.ChainEpoch
}

MiningBase is the tipset on top of which we plan to construct our next block. Refer to godocs on GetBestMiningCandidate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL