Documentation ¶
Index ¶
- Variables
- func ComputeVRF(ctx context.Context, sign SignFunc, account string, worker address.Address, ...) ([]byte, error)
- func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.ChainEpoch, ...) ([]byte, error)
- func IsRoundWinner(ctx context.Context, round abi.ChainEpoch, account string, ...) (*types.ElectionProof, error)
- func ReorgOps(lts func(context.Context, types.TipSetKey) (*types.TipSet, error), ...) ([]*types.TipSet, []*types.TipSet, error)
- type IMinerManager
- type IMinerMining
- type Miner
- func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, ...) ([]types.CountWinners, error)
- func (m *Miner) GetBestMiningCandidate(ctx context.Context) (*MiningBase, error)
- func (m *Miner) ListAddress(ctx context.Context) ([]types.MinerInfo, error)
- func (m *Miner) ManualStart(ctx context.Context, mAddrs []address.Address) error
- func (m *Miner) ManualStop(ctx context.Context, mAddrs []address.Address) error
- func (m *Miner) Start(ctx context.Context) error
- func (m *Miner) StatesForMining(ctx context.Context, addrs []address.Address) ([]types.MinerState, error)
- func (m *Miner) Stop(ctx context.Context) error
- func (m *Miner) SyncStatus(ctx context.Context)
- func (m *Miner) UpdateAddress(ctx context.Context, skip, limit int64) ([]types.MinerInfo, error)
- func (m *Miner) WarmupForMiner(ctx context.Context, mAddr address.Address) error
- type MiningAPI
- type MiningBase
- type MiningWpp
- type SignFunc
- type WinningPoStProver
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxErrCounts = 20
Functions ¶
func ComputeVRF ¶
func DrawRandomness ¶
func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
DrawRandomness todo 在venus处理好后,这里的删除,用venus中的函数
func IsRoundWinner ¶
func IsRoundWinner( ctx context.Context, round abi.ChainEpoch, account string, miner address.Address, brand types.BeaconEntry, mbi *types.MiningBaseInfo, sign SignFunc) (*types.ElectionProof, error)
func ReorgOps ¶
func ReorgOps(lts func(context.Context, types.TipSetKey) (*types.TipSet, error), a, b *types.TipSet) ([]*types.TipSet, []*types.TipSet, error)
ReorgOps takes two tipsets (which can be at different heights), and walks their corresponding chains backwards one step at a time until we find a common ancestor. It then returns the respective chain segments that fork from the identified ancestor, in reverse order, where the first element of each slice is the supplied tipset, and the last element is the common ancestor.
If an error happens along the way, we return the error with nil slices. todo should move this code into store.ReorgOps. anywhere use this function should invoke store.ReorgOps todo 因依赖filecoin-ffi,暂时从venus复制的,venus处理好依赖后删除,用venus中的
Types ¶
type IMinerManager ¶
type IMinerManager interface { UpdateAddress(context.Context, int64, int64) ([]types.MinerInfo, error) ListAddress(context.Context) ([]types.MinerInfo, error) StatesForMining(context.Context, []address.Address) ([]types.MinerState, error) CountWinners(context.Context, []address.Address, abi.ChainEpoch, abi.ChainEpoch) ([]types.CountWinners, error) WarmupForMiner(context.Context, address.Address) error }
type IMinerMining ¶
type Miner ¶
type Miner struct { PropagationDelaySecs uint64 MinerOnceTimeout time.Duration MpoolSelectDelaySecs uint64 // contains filtered or unexported fields }
func NewMiner ¶
func NewMiner( metricsCtx helpers.MetricsCtx, api v1api.FullNode, cfg *config.MinerConfig, minerManager miner_manager.MinerManageAPI, sf slashfilter.SlashFilterAPI, j journal.Journal) (*Miner, error)
NewMiner instantiates a miner with a concrete WinningPoStProver and a miner address (which can be different from the worker's address).
func (*Miner) CountWinners ¶
func (m *Miner) CountWinners(ctx context.Context, addrs []address.Address, start abi.ChainEpoch, end abi.ChainEpoch) ([]types.CountWinners, error)
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.
func (*Miner) ListAddress ¶
func (*Miner) ManualStart ¶
func (*Miner) ManualStop ¶
func (*Miner) StatesForMining ¶
func (*Miner) Stop ¶
Stop stops the mining operation. It is not idempotent, and multiple adjacent calls to Stop will fail.
func (*Miner) SyncStatus ¶
func (*Miner) UpdateAddress ¶
type MiningAPI ¶
type MiningAPI interface { IMinerMining IMinerManager }
type MiningBase ¶
type MiningBase struct { TipSet *sharedTypes.TipSet NullRounds abi.ChainEpoch }
MiningBase is the tipset on top of which we plan to construct our next block.
type MiningWpp ¶
type MiningWpp struct {
// contains filtered or unexported fields
}
func NewWinningPoStProver ¶
func (*MiningWpp) ComputeProof ¶
func (wpp *MiningWpp) ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, currEpoch abi.ChainEpoch, nv network.Version) ([]builtin.PoStProof, error)
func (*MiningWpp) GenerateCandidates ¶
type WinningPoStProver ¶
type WinningPoStProver interface { GenerateCandidates(context.Context, abi.PoStRandomness, uint64) ([]uint64, error) ComputeProof(context.Context, []builtin.ExtendedSectorInfo, abi.PoStRandomness, abi.ChainEpoch, network.Version) ([]builtin.PoStProof, error) }