mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-03-11 11:18:13 +08:00
fix iterator bug
This commit is contained in:
parent
d9d961ebdb
commit
d2c5b42cdf
@ -556,8 +556,16 @@ func (e *DataClockConsensusEngine) Start() <-chan error {
|
||||
}
|
||||
|
||||
frame = nextFrame
|
||||
_, tries, err := e.clockStore.GetDataClockFrame(
|
||||
e.filter,
|
||||
frame.FrameNumber,
|
||||
false,
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for i, trie := range e.GetFrameProverTries()[1:] {
|
||||
for i, trie := range tries[1:] {
|
||||
if trie.Contains(peerProvingKeyAddress) {
|
||||
e.logger.Info("creating data shard ring proof", zap.Int("ring", i))
|
||||
e.PerformTimeProof(frame, frame.Difficulty, clients)
|
||||
@ -578,6 +586,7 @@ func (e *DataClockConsensusEngine) PerformTimeProof(
|
||||
wg.Add(len(clients))
|
||||
output := make([][]byte, len(clients))
|
||||
for i, client := range clients {
|
||||
i := i
|
||||
client := client
|
||||
go func() {
|
||||
e.logger.Info("performing data proof")
|
||||
@ -621,7 +630,10 @@ func (e *DataClockConsensusEngine) PerformTimeProof(
|
||||
break
|
||||
}
|
||||
if j == 0 {
|
||||
e.logger.Error("unable to get a response in time from worker", zap.Error(err))
|
||||
e.logger.Error(
|
||||
"unable to get a response in time from worker",
|
||||
zap.Error(err),
|
||||
)
|
||||
}
|
||||
if len(e.config.Engine.DataWorkerMultiaddrs) != 0 {
|
||||
e.logger.Error(
|
||||
|
||||
@ -118,8 +118,20 @@ func (e *DataClockConsensusEngine) processFrame(
|
||||
|
||||
return nextFrame
|
||||
} else {
|
||||
if !e.IsInProverTrie(e.pubSub.GetPeerID()) &&
|
||||
dataFrame.Timestamp > time.Now().UnixMilli()-30000 {
|
||||
_, tries, err := e.clockStore.GetDataClockFrame(
|
||||
e.filter,
|
||||
latestFrame.FrameNumber,
|
||||
false,
|
||||
)
|
||||
if err != nil {
|
||||
e.logger.Error("error while fetching frame", zap.Error(err))
|
||||
return latestFrame
|
||||
}
|
||||
found := false
|
||||
for _, trie := range tries[1:] {
|
||||
found = found || trie.Contains(e.pubSub.GetPeerID())
|
||||
}
|
||||
if !found && dataFrame.Timestamp > time.Now().UnixMilli()-30000 {
|
||||
e.logger.Info("announcing prover join")
|
||||
e.announceProverJoin()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user