strongcoin2

package
v0.0.0-...-ff61ee7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStrongCoin2

func NewStrongCoin2() consinterface.CoinItemInterface

Types

type MsgState

type MsgState struct {
	// contains filtered or unexported fields
}

StrongCoin2MsgState represents the state of messages implementing a strong coin through the use of threshold signatures.

func NewStrongCoin2MsgState

func NewStrongCoin2MsgState(isMv bool,
	gc *generalconfig.GeneralConfig) *MsgState

NewStrongCoin2MsgState generates a new StrongCoin2MsgState 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

func (sms *MsgState) GetCoinSignType() types.SignType

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

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

New creates a new empty StrongCoin2MsgState object for the consensus index idx.

type StrongCoin2

type StrongCoin2 struct {
}

StrongCoin2 represents a strong coin implemented by an n-t (or t+1) threshold random coin (cachin'05)

func (*StrongCoin2) CheckCoinMessage

func (sc1 *StrongCoin2) CheckCoinMessage(deser *deserialized.DeserializedItem,
	isLocal bool, alwaysGenerate 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 (*StrongCoin2) GenerateCoinMessage

func (sc1 *StrongCoin2) GenerateCoinMessage(round types.ConsensusRound, alwaysGenerate bool, consItem consinterface.ConsItem,
	coinMsgState consinterface.CoinMessageStateInterface, msgState consinterface.MessageState) (ret messages.MsgHeader)

func (StrongCoin2) GetBufferCount

func (StrongCoin2) GetBufferCount(hdr messages.MsgIDHeader, gc *generalconfig.GeneralConfig,
	memberChecker *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 (StrongCoin2) GetHeader

func (StrongCoin2) GetHeader(emptyPub sig.Pub, _ *generalconfig.GeneralConfig,
	headerID 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).

Jump to

Keyboard shortcuts

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