fix: announce peer based on leading frame, not initial frame; fix: looping bug

This commit is contained in:
Cassandra Heart 2024-10-20 23:45:16 -05:00
parent 23adc7e496
commit 11a357518a
No known key found for this signature in database
GPG Key ID: 6352152859385958
3 changed files with 12 additions and 5 deletions

View File

@ -302,11 +302,11 @@ func (e *DataClockConsensusEngine) sync(
}
func (e *DataClockConsensusEngine) collect(
currentFramePublished *protobufs.ClockFrame,
enqueuedFrame *protobufs.ClockFrame,
) (*protobufs.ClockFrame, error) {
e.logger.Info("collecting vdf proofs")
latest := currentFramePublished
latest := enqueuedFrame
for {
peerId, maxFrame, err := e.GetMostAheadPeer(latest.FrameNumber)

View File

@ -330,7 +330,8 @@ func (e *DataClockConsensusEngine) Start() <-chan error {
panic(err)
}
if frame.FrameNumber >= nextFrame.FrameNumber || frame.FrameNumber == 0 {
if frame.FrameNumber >= nextFrame.FrameNumber ||
nextFrame.FrameNumber == 0 {
time.Sleep(30 * time.Second)
continue
}

View File

@ -606,7 +606,10 @@ func (d *DataTimeReel) setHead(frame *protobufs.ClockFrame, distance *big.Int) {
d.headDistance = distance
go func() {
d.newFrameCh <- frame
select {
case d.newFrameCh <- frame:
default:
}
}()
}
@ -906,7 +909,10 @@ func (d *DataTimeReel) forkChoice(
)
go func() {
d.newFrameCh <- frame
select {
case d.newFrameCh <- frame:
default:
}
}()
}