fix: handle large consensus batches

This commit is contained in:
Cassandra Heart 2023-10-05 17:01:16 -05:00
parent 520d6562f9
commit 5bce33216f
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -687,12 +687,12 @@ func (e *CeremonyDataClockConsensusEngine) commitLongestPath(
zap.Int("commit_depth", len(runningFrames[0])), zap.Int("commit_depth", len(runningFrames[0])),
) )
txn, err := e.clockStore.NewTransaction()
if err != nil {
return nil, errors.Wrap(err, "commit longest path")
}
for _, s := range runningFrames[0][1:] { for _, s := range runningFrames[0][1:] {
txn, err := e.clockStore.NewTransaction()
if err != nil {
return nil, errors.Wrap(err, "commit longest path")
}
e.logger.Info( e.logger.Info(
"committing candidate", "committing candidate",
zap.Uint64("frame_number", s.FrameNumber), zap.Uint64("frame_number", s.FrameNumber),
@ -796,14 +796,14 @@ func (e *CeremonyDataClockConsensusEngine) commitLongestPath(
} }
} }
} }
}
if err := txn.Commit(); err != nil { if err := txn.Commit(); err != nil {
e.logger.Error( e.logger.Error(
"could not commit candidates", "could not commit candidates",
zap.Error(err), zap.Error(err),
) )
return nil, errors.Wrap(err, "commit longest path") return nil, errors.Wrap(err, "commit longest path")
}
} }
runningFrames = [][]*protobufs.ClockFrame{ runningFrames = [][]*protobufs.ClockFrame{