adjust runonce

This commit is contained in:
Cassandra Heart 2024-11-16 18:29:41 -06:00
parent 08e7dad8c9
commit 706ec2997d
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -71,9 +71,20 @@ func (e *DataClockConsensusEngine) runLoop() {
panic(err)
}
if runOnce {
if e.GetFrameProverTries()[0].Contains(e.provingKeyAddress) {
dataFrame, err := e.dataTimeReel.Head()
if err != nil {
panic(err)
}
latestFrame = e.processFrame(latestFrame, dataFrame)
}
runOnce = false
}
select {
case dataFrame := <-dataFrameCh:
runOnce = false
if e.GetFrameProverTries()[0].Contains(e.provingKeyAddress) {
if err = e.publishProof(dataFrame); err != nil {
e.logger.Error("could not publish", zap.Error(err))
@ -86,14 +97,10 @@ func (e *DataClockConsensusEngine) runLoop() {
}
latestFrame = e.processFrame(latestFrame, dataFrame)
case <-time.After(20 * time.Second):
if e.GetFrameProverTries()[0].Contains(e.provingKeyAddress) && !runOnce {
if e.GetFrameProverTries()[0].Contains(e.provingKeyAddress) {
continue
}
if runOnce {
runOnce = false
}
dataFrame, err := e.dataTimeReel.Head()
if err != nil {
panic(err)