common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MoneroKeyGenSharepre      = "moneroKeyGenSharePre"
	MoneroKeyGenShareExchange = "moneroKeyGenShareExchange"
	MoneroExportedSignMsg     = "moneroExportedSignMsg"
	MoneroInitTransfer        = "moneroInitTrnasfer"
	MoneroSignShares          = "moneroSignShares"
)

Variables

This section is empty.

Functions

func GenerateSignature

func GenerateSignature(msg []byte, msgID string, privKey tcrypto.PrivKey) ([]byte, error)

func GetMsgRound

func GetMsgRound(wireMsg *messages.WireMessage, partyID *btss.PartyID, isMonero bool) (tb.RoundInfo, error)

func VerifySignature

func VerifySignature(pubKey tcrypto.PubKey, message, sig []byte, msgID string) bool

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) IsInConfirmedList

func (l *LocalCacheItem) IsInConfirmedList(id string) bool

IsInConfirmedList check whether the given id is in confirmed list

func (*LocalCacheItem) RemovePeer

func (l *LocalCacheItem) RemovePeer(id string)

RemovePeer remove the given peer from confirmed list

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 MoneroShare

type MoneroShare struct {
	MultisigInfo  string `json:"multisig_info"`
	MsgType       string `json:"message_type"`
	ExchangeRound int    `json:"exchangeRound"`
	// the sender field is only used for keysign
	Sender string `json:"message_sender"`
}

func (*MoneroShare) Equal

func (s *MoneroShare) Equal(in *MoneroShare) bool

type PartyInfo

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

PartyInfo the information used by tss key gen and key sign

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) GetMsgID

func (t *TssCommon) GetMsgID() string

func (*TssCommon) GetNodePrivKey

func (t *TssCommon) GetNodePrivKey() 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, moneroShareChan chan *MoneroShare)

func (*TssCommon) ProcessOneMessage

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

func (*TssCommon) ProcessOutCh

func (t *TssCommon) ProcessOutCh(msg []byte, r *btss.MessageRouting, roundInfo string, 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
	// enable the tss monitor
	EnableMonitor bool
	// tss need to access two monero wallet RPC , one for current active asgard , and one for retiring asgard
	// Mostly of the time it will only have active asgard , but during migration , it will have both retiring and active asgard
	// Monero wallet RPC endpoint - A
	WalletRPCA string
	// Monero wallet RPC endpoint - B
	WalletRPCB string
	// WalletPassword the password used to secure wallet
	WalletPassword string
}

TssConfig configurations

func (TssConfig) GetWalletRPC

func (cfg TssConfig) GetWalletRPC(exclude string) string

GetWalletRPC get the next wallet RPC url , we have two wallet RPC at the same time, the wallet hold active asgard can't be used to keygen

Jump to

Keyboard shortcuts

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