Documentation ¶
Index ¶
- func NewKnownCoin() consinterface.CoinItemInterface
- type KnownCoin
- func (*KnownCoin) CheckCoinMessage(*deserialized.DeserializedItem, bool, bool, consinterface.ConsItem, ...) (round types.ConsensusRound, ret messages.MsgHeader, ...)
- func (sc1 *KnownCoin) GenerateCoinMessage(types.ConsensusRound, bool, consinterface.ConsItem, ...) (ret messages.MsgHeader)
- func (KnownCoin) GetBufferCount(messages.MsgIDHeader, *generalconfig.GeneralConfig, *consinterface.MemCheckers) (endThreshold int, maxPossible int, msgid messages.MsgID, err error)
- func (KnownCoin) GetHeader(sig.Pub, *generalconfig.GeneralConfig, messages.HeaderID) (messages.MsgHeader, error)
- type MsgState
- func (sms *MsgState) CheckFinishedMessage(deser *deserialized.DeserializedItem) bool
- func (sms *MsgState) GetCoinSignType() types.SignType
- func (sms *MsgState) GetCoins(round types.ConsensusRound) []types.BinVal
- func (sms *MsgState) GotMsg(consinterface.MessageState, *deserialized.DeserializedItem, ...) (types.ConsensusRound, error)
- func (sms *MsgState) New(_ types.ConsensusIndex, presets []struct{ ... }) consinterface.CoinMessageStateInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKnownCoin ¶
func NewKnownCoin() consinterface.CoinItemInterface
Types ¶
type KnownCoin ¶
type KnownCoin struct { }
KnownCoin represents a non-random coin.
func (*KnownCoin) CheckCoinMessage ¶
func (*KnownCoin) CheckCoinMessage(*deserialized.DeserializedItem, bool, bool, consinterface.ConsItem, consinterface.CoinMessageStateInterface, consinterface.MessageState) (round types.ConsensusRound, ret messages.MsgHeader, progress, shouldForward bool, err error)
CheckCoinMessage should be called from within ProcessMessage of the ConsensusItem that is using this coin. It returns the round the coin corresponds to and true in first boolean position if made progress towards decision, or false if already decided, and return true in second position if the message should be forwarded. If the message is invalid an error is returned.
func (*KnownCoin) GenerateCoinMessage ¶
func (sc1 *KnownCoin) GenerateCoinMessage(types.ConsensusRound, bool, consinterface.ConsItem, consinterface.CoinMessageStateInterface, consinterface.MessageState) (ret messages.MsgHeader)
func (KnownCoin) GetBufferCount ¶
func (KnownCoin) GetBufferCount(messages.MsgIDHeader, *generalconfig.GeneralConfig, *consinterface.MemCheckers) (endThreshold int, maxPossible int, msgid messages.MsgID, err error)
GetBufferCount returns the thresholds for messages of type coin. The thresholds are n-t.
func (KnownCoin) GetHeader ¶
func (KnownCoin) GetHeader(sig.Pub, *generalconfig.GeneralConfig, messages.HeaderID) (messages.MsgHeader, error)
GetHeader should a blank message header for the HeaderID, this object will be used to deserialize a message into itself (see consinterface.DeserializeMessage).
type MsgState ¶
type MsgState struct {
// contains filtered or unexported fields
}
KnownCoinMsgState represents the state of messages implementing a strong coin through the use of threshold signatures.
func NewFlipCoinMsgState ¶
func NewFlipCoinMsgState(isMv bool, _ *generalconfig.GeneralConfig) *MsgState
func NewKnownCoinMsgState ¶
func NewKnownCoinMsgState(isMv bool, _ *generalconfig.GeneralConfig) *MsgState
NewKnownCoinMsgState generates a new KnownCoinMsgState object.
func (*MsgState) CheckFinishedMessage ¶
func (sms *MsgState) CheckFinishedMessage(deser *deserialized.DeserializedItem) bool
CheckFinishedMessage checks if the message is for the coin and if the coin is already known. If so true is returned, false otherwise.
func (*MsgState) GetCoinSignType ¶
GetCoinSignType returns what type of signature is used to sign coin messages
func (*MsgState) GetCoins ¶
func (sms *MsgState) GetCoins(round types.ConsensusRound) []types.BinVal
GetCoins returns the set of binary coin values that are currently valid.
func (*MsgState) GotMsg ¶
func (sms *MsgState) GotMsg(consinterface.MessageState, *deserialized.DeserializedItem, *generalconfig.GeneralConfig, *consinterface.MemCheckers) (types.ConsensusRound, error)
GotMsg processes messages of type CoinMessage. Once an n-t threshold of these messages have been received from different processes the value of the coin is revealed.
func (*MsgState) New ¶
func (sms *MsgState) New(_ types.ConsensusIndex, presets []struct { Round types.ConsensusRound Val types.BinVal }) consinterface.CoinMessageStateInterface
New creates a new empty KnownCoinMsgState object for the consensus index idx.