Skip to content

Commit f4f9b4d

Browse files
committed
not resetting the signatories in the background to prevent race condition
1 parent 9230a2c commit f4f9b4d

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

replica/replica.go

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,6 @@ func (replica *Replica) Run(ctx context.Context) {
132132
case process.Height:
133133
replica.proc.State = process.DefaultState().WithCurrentHeight(m)
134134
replica.mq.DropMessagesBelowHeight(m)
135-
case []id.Signatory:
136-
procAllowed := map[id.Signatory]bool{}
137-
for _, sig := range m {
138-
procAllowed[sig] = true
139-
}
140-
replica.procsAllowed = procAllowed
141-
142-
scheduler := scheduler.NewRoundRobin(m)
143-
f := len(procAllowed) / 3
144-
replica.proc.ResetF(uint64(f), scheduler)
145135
}
146136
}
147137

@@ -232,10 +222,15 @@ func (replica *Replica) ResetHeight(ctx context.Context, newHeight process.Heigh
232222
return
233223
}
234224

235-
select {
236-
case <-ctx.Done():
237-
case replica.mch <- signatories:
225+
procAllowed := map[id.Signatory]bool{}
226+
for _, sig := range signatories {
227+
procAllowed[sig] = true
238228
}
229+
replica.procsAllowed = procAllowed
230+
231+
scheduler := scheduler.NewRoundRobin(signatories)
232+
f := len(procAllowed) / 3
233+
replica.proc.ResetF(uint64(f), scheduler)
239234
}
240235

241236
// State returns the current height, round and step of the underlying process.

0 commit comments

Comments
 (0)