fix iterator bug

This commit is contained in:
Cassandra Heart 2024-11-05 21:24:27 -06:00
parent d9d961ebdb
commit d2c5b42cdf
No known key found for this signature in database
GPG Key ID: 6352152859385958
2 changed files with 28 additions and 4 deletions

View File

@ -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(

View File

@ -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()
}