Documentation ¶
Index ¶
- type Message
- type Option
- type UnitAllowances
- type WeakCoin
- func (wc *WeakCoin) FinishEpoch(ctx context.Context, epoch types.EpochID)
- func (wc *WeakCoin) FinishRound(ctx context.Context)
- func (wc *WeakCoin) Get(ctx context.Context, epoch types.EpochID, round types.RoundID) bool
- func (wc *WeakCoin) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
- func (wc *WeakCoin) StartEpoch(ctx context.Context, epoch types.EpochID, allowances UnitAllowances)
- func (wc *WeakCoin) StartRound(ctx context.Context, round types.RoundID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Epoch types.EpochID Round types.RoundID Unit uint64 MinerPK []byte Signature []byte }
Message defines weak coin message format.
func (*Message) DecodeScale ¶
DecodeScale implements scale codec interface.
func (*Message) EncodeScale ¶
EncodeScale implements scale codec interface.
type Option ¶
type Option func(*WeakCoin)
Option for optional configuration adjustments.
func WithNextRoundBufferSize ¶
WithNextRoundBufferSize changes size of the buffer for messages from future rounds.
func WithThreshold ¶
WithThreshold changes signature threshold.
func WithVerifier ¶
WithVerifier changes the verifier of the weakcoin messages.
type UnitAllowances ¶
UnitAllowances is a map from miner identifier to the number of units of spacetime.
type WeakCoin ¶
type WeakCoin struct {
// contains filtered or unexported fields
}
WeakCoin implementation of the protocol.
func (*WeakCoin) FinishEpoch ¶
FinishEpoch completes epoch. After it is called Get for this epoch will panic.
func (*WeakCoin) FinishRound ¶
FinishRound computes coinflip based on proposals received in this round. After it is called new proposals for this round won't be accepted.
func (*WeakCoin) Get ¶
Get the result of the coin flip in this round. It is only valid in between StartEpoch/EndEpoch and only after CompleteRound was called.
func (*WeakCoin) HandleProposal ¶
func (wc *WeakCoin) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
HandleProposal defines method to handle Beacon Weak Coin Messages from gossip.
func (*WeakCoin) StartEpoch ¶
StartEpoch notifies that epoch is started and we can accept messages for this epoch.