Documentation ¶
Index ¶
- Constants
- type Agent
- func (a *Agent) Close() error
- func (a *Agent) HasEnoughFundsToPlay(ctx context.Context) (*big.Int, bool, error)
- func (a *Agent) Metrics() []prometheus.Collector
- func (a *Agent) SampleWithProofs(ctx context.Context, anchor1 []byte, anchor2 []byte, storageRadius uint8) (SampleWithProofs, error)
- func (a *Agent) Status() (*Status, error)
- type ChainBackend
- type Health
- type PhaseType
- type RedistributionState
- func (r *RedistributionState) AddFee(ctx context.Context, txHash common.Hash)
- func (r *RedistributionState) CalculateWinnerReward(ctx context.Context) error
- func (r *RedistributionState) CommitKey(round uint64) ([]byte, bool)
- func (r *RedistributionState) HasRevealed(round uint64) bool
- func (r *RedistributionState) IsFrozen() bool
- func (r *RedistributionState) IsFullySynced() bool
- func (r *RedistributionState) IsHealthy() bool
- func (r *RedistributionState) SampleData(round uint64) (SampleData, bool)
- func (r *RedistributionState) SetBalance(ctx context.Context) error
- func (r *RedistributionState) SetCommitKey(round uint64, commitKey []byte)
- func (r *RedistributionState) SetCurrentBlock(block uint64)
- func (r *RedistributionState) SetCurrentEvent(phase PhaseType, round uint64)
- func (r *RedistributionState) SetFrozen(isFrozen bool, round uint64)
- func (r *RedistributionState) SetFullySynced(isSynced bool)
- func (r *RedistributionState) SetHasRevealed(round uint64)
- func (r *RedistributionState) SetHealthy(isHealthy bool)
- func (r *RedistributionState) SetLastPlayedRound(round uint64)
- func (r *RedistributionState) SetLastSelectedRound(round uint64)
- func (r *RedistributionState) SetLastWonRound(round uint64)
- func (r *RedistributionState) SetSampleData(round uint64, sd SampleData, dur time.Duration)
- func (r *RedistributionState) Status() (*Status, error)
- type RoundData
- type SampleData
- type SampleWithProofs
- type Status
Constants ¶
View Source
const ( DefaultBlocksPerRound = 152 DefaultBlocksPerPhase = DefaultBlocksPerRound / 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func New ¶
func New(overlay swarm.Address, ethAddress common.Address, backend ChainBackend, contract redistribution.Contract, batchExpirer postagecontract.PostageBatchExpirer, redistributionStatuser staking.RedistributionStatuser, store storer.Reserve, fullSyncedFunc func() bool, blockTime time.Duration, blocksPerRound, blocksPerPhase uint64, stateStore storage.StateStorer, chainStateGetter postage.ChainStateGetter, erc20Service erc20.Service, tranService transaction.Service, health Health, logger log.Logger, ) (*Agent, error)
func (*Agent) HasEnoughFundsToPlay ¶
func (*Agent) SampleWithProofs ¶
func (a *Agent) SampleWithProofs( ctx context.Context, anchor1 []byte, anchor2 []byte, storageRadius uint8, ) (SampleWithProofs, error)
SampleWithProofs is called only by rchash API
type ChainBackend ¶
type RedistributionState ¶
type RedistributionState struct {
// contains filtered or unexported fields
}
func NewRedistributionState ¶
func NewRedistributionState(logger log.Logger, ethAddress common.Address, stateStore storage.StateStorer, erc20Service erc20.Service, contract transaction.Service) (*RedistributionState, error)
func (*RedistributionState) AddFee ¶
func (r *RedistributionState) AddFee(ctx context.Context, txHash common.Hash)
AddFee sets the internal node status
func (*RedistributionState) CalculateWinnerReward ¶
func (r *RedistributionState) CalculateWinnerReward(ctx context.Context) error
CalculateWinnerReward calculates the reward for the winner
func (*RedistributionState) CommitKey ¶
func (r *RedistributionState) CommitKey(round uint64) ([]byte, bool)
func (*RedistributionState) HasRevealed ¶
func (r *RedistributionState) HasRevealed(round uint64) bool
func (*RedistributionState) IsFrozen ¶
func (r *RedistributionState) IsFrozen() bool
func (*RedistributionState) IsFullySynced ¶
func (r *RedistributionState) IsFullySynced() bool
func (*RedistributionState) IsHealthy ¶
func (r *RedistributionState) IsHealthy() bool
func (*RedistributionState) SampleData ¶
func (r *RedistributionState) SampleData(round uint64) (SampleData, bool)
func (*RedistributionState) SetBalance ¶
func (r *RedistributionState) SetBalance(ctx context.Context) error
func (*RedistributionState) SetCommitKey ¶
func (r *RedistributionState) SetCommitKey(round uint64, commitKey []byte)
func (*RedistributionState) SetCurrentBlock ¶
func (r *RedistributionState) SetCurrentBlock(block uint64)
func (*RedistributionState) SetCurrentEvent ¶
func (r *RedistributionState) SetCurrentEvent(phase PhaseType, round uint64)
func (*RedistributionState) SetFrozen ¶
func (r *RedistributionState) SetFrozen(isFrozen bool, round uint64)
func (*RedistributionState) SetFullySynced ¶
func (r *RedistributionState) SetFullySynced(isSynced bool)
func (*RedistributionState) SetHasRevealed ¶
func (r *RedistributionState) SetHasRevealed(round uint64)
func (*RedistributionState) SetHealthy ¶
func (r *RedistributionState) SetHealthy(isHealthy bool)
func (*RedistributionState) SetLastPlayedRound ¶
func (r *RedistributionState) SetLastPlayedRound(round uint64)
func (*RedistributionState) SetLastSelectedRound ¶
func (r *RedistributionState) SetLastSelectedRound(round uint64)
func (*RedistributionState) SetLastWonRound ¶
func (r *RedistributionState) SetLastWonRound(round uint64)
func (*RedistributionState) SetSampleData ¶
func (r *RedistributionState) SetSampleData(round uint64, sd SampleData, dur time.Duration)
func (*RedistributionState) Status ¶
func (r *RedistributionState) Status() (*Status, error)
Status returns the node status
type RoundData ¶
type RoundData struct { CommitKey []byte SampleData *SampleData HasRevealed bool }
type SampleData ¶
type SampleWithProofs ¶
type SampleWithProofs struct { Hash swarm.Address `json:"hash"` Proofs redistribution.ChunkInclusionProofs `json:"proofs"` Duration time.Duration `json:"duration"` }
type Status ¶
type Status struct { Phase PhaseType IsFrozen bool IsFullySynced bool Round uint64 LastWonRound uint64 LastPlayedRound uint64 LastFrozenRound uint64 LastSelectedRound uint64 Block uint64 Reward *big.Int Fees *big.Int RoundData map[uint64]RoundData SampleDuration time.Duration IsHealthy bool }
Status provide internal status of the nodes in the redistribution game
Click to show internal directories.
Click to hide internal directories.