common

package
v1.0.6-chaosnet Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 29 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s []*btss.PartyID, e *btss.PartyID) bool

func GetMsgRound

func GetMsgRound(wireMsg *messages.WireMessage, partyID *btss.PartyID) (blame.RoundInfo, error)

func GetThreshold

func GetThreshold(value int) (int, error)

func InitLog

func InitLog(level string, pretty bool, serviceValue string)

func MsgToHashInt

func MsgToHashInt(msg []byte) (*big.Int, error)

func MsgToHashString

func MsgToHashString(msg []byte) (string, error)

Types

type LocalCacheItem

type LocalCacheItem struct {
	Msg  *messages.WireMessage
	Hash string

	ConfirmedList map[string]string
	// contains filtered or unexported fields
}

LocalCacheItem used to cache the unconfirmed broadcast message

func NewLocalCacheItem

func NewLocalCacheItem(msg *messages.WireMessage, hash string) *LocalCacheItem

func (*LocalCacheItem) GetPeers

func (l *LocalCacheItem) GetPeers() []string

func (*LocalCacheItem) TotalConfirmParty

func (l *LocalCacheItem) TotalConfirmParty() int

TotalConfirmParty number of parties that already confirmed their hash

func (*LocalCacheItem) UpdateConfirmList

func (l *LocalCacheItem) UpdateConfirmList(P2PID, hash string)

UpdateConfirmList add the given party's hash into the confirm list

type PartyInfo

type PartyInfo struct {
	Party      btss.Party
	PartyIDMap map[string]*btss.PartyID
}

PartyInfo the information used by tss key gen and key sign

type Status

type Status byte
const (
	NA Status = iota
	Success
	Fail
)

type TssCommon

type TssCommon struct {
	PartyIDtoP2PID map[string]peer.ID

	TssMsg   chan *p2p.Message
	P2PPeers []peer.ID // most of tss message are broadcast, we store the peers ID to avoid iterating
	// contains filtered or unexported fields
}

func NewTssCommon

func NewTssCommon(peerID string, broadcastChannel chan *messages.BroadcastMsgChan, conf TssConfig, msgID string, privKey tcrypto.PrivKey) *TssCommon

func (*TssCommon) GetBlameMgr

func (t *TssCommon) GetBlameMgr() *blame.Manager

func (*TssCommon) GetConf

func (t *TssCommon) GetConf() TssConfig

GetConf get current configuration for Tss

func (*TssCommon) GetLocalPeerID

func (t *TssCommon) GetLocalPeerID() string

func (*TssCommon) GetTaskDone

func (t *TssCommon) GetTaskDone() chan struct{}

func (*TssCommon) NotifyTaskDone

func (t *TssCommon) NotifyTaskDone() error

func (*TssCommon) ProcessInboundMessages

func (t *TssCommon) ProcessInboundMessages(finishChan chan struct{}, wg *sync.WaitGroup)

func (*TssCommon) ProcessOneMessage

func (t *TssCommon) ProcessOneMessage(wrappedMsg *messages.WrappedMessage, peerID string) error

func (*TssCommon) ProcessOutCh

func (t *TssCommon) ProcessOutCh(msg btss.Message, msgType messages.THORChainTSSMessageType) error

func (*TssCommon) SetLocalPeerID

func (t *TssCommon) SetLocalPeerID(peerID string)

func (*TssCommon) SetPartyInfo

func (t *TssCommon) SetPartyInfo(partyInfo *PartyInfo)

func (*TssCommon) TryGetAllLocalCached

func (t *TssCommon) TryGetAllLocalCached() []*LocalCacheItem

func (*TssCommon) TryGetLocalCacheItem

func (t *TssCommon) TryGetLocalCacheItem(key string) *LocalCacheItem

type TssConfig

type TssConfig struct {
	// Party Timeout defines how long do we wait for the party to form
	PartyTimeout time.Duration
	// KeyGenTimeoutSeconds defines how long do we wait the keygen parties to pass messages along
	KeyGenTimeout time.Duration
	// KeySignTimeoutSeconds defines how long do we wait keysign
	KeySignTimeout time.Duration
	// Pre-parameter define the pre-parameter generations timeout
	PreParamTimeout time.Duration
}

type TssStatus

type TssStatus struct {
	// Starttime indicates when the Tss server starts
	Starttime time.Time `json:"start_time"`
	// SucKeyGen indicates how many times we run keygen successfully
	SucKeyGen uint64 `json:"successful_keygen"`
	// FailedKeyGen indicates how many times we run keygen unsuccessfully(the invalid http request is not counted as
	// the failure of keygen)
	FailedKeyGen uint64 `json:"failed_keygen"`
	// SucKeySign indicates how many times we run keySign successfully
	SucKeySign uint64 `json:"successful_keysign"`
	// FailedKeySign indicates how many times we run keysign unsuccessfully(the invalid http request is not counted as
	// the failure of keysign)
	FailedKeySign uint64 `json:"failed_keysign"`
}

Jump to

Keyboard shortcuts

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