mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-10 18:25:17 +00:00
fix: weird state from dropped channels
This commit is contained in:
parent
175a35edec
commit
d151e14166
@ -884,10 +884,10 @@ func (a *CeremonyApplication) ApplyTransition(
|
||||
maxRounds = maxRounds << 1
|
||||
}
|
||||
|
||||
if a.RoundCount == maxRounds &&
|
||||
if a.RoundCount >= maxRounds &&
|
||||
uint64(len(a.TranscriptRoundAdvanceCommits)) == a.RoundCount &&
|
||||
len(a.ActiveParticipants) ==
|
||||
len(a.TranscriptRoundAdvanceCommits[a.RoundCount-1].Commits) {
|
||||
len(a.TranscriptRoundAdvanceCommits[maxRounds-1].Commits) {
|
||||
a.LobbyState = CEREMONY_APPLICATION_STATE_FINALIZING
|
||||
a.FinalCommits = a.TranscriptRoundAdvanceCommits[a.RoundCount-1].Commits
|
||||
a.RoundCount = 0
|
||||
|
@ -220,15 +220,15 @@ func (a *CeremonyApplication) applyTranscriptCommit(
|
||||
}
|
||||
}
|
||||
|
||||
if maxRounds < a.RoundCount-1 {
|
||||
return errors.Wrap(
|
||||
errors.New("round limit exceeded"),
|
||||
"apply transcript commit",
|
||||
)
|
||||
}
|
||||
|
||||
if len(a.TranscriptRoundAdvanceCommits[a.RoundCount-1].Commits) ==
|
||||
len(a.ActiveParticipants) {
|
||||
if maxRounds ==
|
||||
uint64(len(a.TranscriptRoundAdvanceCommits)) {
|
||||
return errors.Wrap(
|
||||
errors.New("round limit exceeded"),
|
||||
"apply transcript commit",
|
||||
)
|
||||
}
|
||||
a.TranscriptRoundAdvanceCommits = append(
|
||||
a.TranscriptRoundAdvanceCommits,
|
||||
&protobufs.CeremonyAdvanceRound{
|
||||
|
@ -425,6 +425,7 @@ func (e *CeremonyExecutionEngine) RunWorker() {
|
||||
err := e.connectToActivePeers(app, position)
|
||||
if err != nil {
|
||||
e.logger.Error("error while connecting to peers", zap.Error(err))
|
||||
e.publishDroppedParticipant(e.proverPublicKey)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -703,6 +704,14 @@ func (e *CeremonyExecutionEngine) connectToActivePeers(
|
||||
e.pubSub,
|
||||
)
|
||||
if err != nil {
|
||||
e.logger.Error(
|
||||
"could not establish p2p channel",
|
||||
zap.Binary(
|
||||
"proving_key",
|
||||
p.PublicKeySignatureEd448.PublicKey.KeyValue,
|
||||
),
|
||||
zap.Error(err),
|
||||
)
|
||||
return errors.Wrap(err, "connect to active peers")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user