Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions eth/stagedsync/stage_headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,8 @@ func startHandlingForkChoice(

if header == nil {
log.Info(fmt.Sprintf("[%s] Fork choice: need to download header with hash %x", s.LogPrefix(), headerHash))
if test {
cfg.hd.BeaconRequestList.Remove(requestId)
} else {
cfg.hd.BeaconRequestList.Remove(requestId)
if !test {
schedulePoSDownload(requestId, headerHash, 0 /* header height is unknown, setting to 0 */, headerHash, s, cfg)
}
return &engineapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil
Expand Down Expand Up @@ -436,8 +435,8 @@ func handleNewPayload(
}
if parent == nil {
log.Info(fmt.Sprintf("[%s] New payload: need to download parent", s.LogPrefix()), "height", headerNumber, "hash", headerHash, "parentHash", header.ParentHash)
cfg.hd.BeaconRequestList.Remove(requestId)
if test {
cfg.hd.BeaconRequestList.Remove(requestId)
return &engineapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil
}
if !schedulePoSDownload(requestId, header.ParentHash, headerNumber-1, headerHash /* downloaderTip */, s, cfg) {
Expand Down
6 changes: 6 additions & 0 deletions turbo/stages/sentry_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,17 @@ func TestPoSDownloader(t *testing.T) {
require.NoError(t, err)
stages.SendPayloadStatus(m.HeaderDownload(), headBlockHash, err)

// Since we are removing the current request to avoid the deadlock, we need to send the new payload (or fcu) request again.
m.SendPayloadRequest(chain.TopBlock)
// Second cycle: process the previous beacon request
headBlockHash, err = stages.StageLoopStep(m.Ctx, m.DB, m.Sync, 0, m.Notifications, initialCycle, m.UpdateHead, nil)
require.NoError(t, err)
stages.SendPayloadStatus(m.HeaderDownload(), headBlockHash, err)
assert.Equal(t, chain.TopBlock.Hash(), headBlockHash)
// Second cycle: checking the response
payloadStatus = m.ReceivePayloadStatus()
assert.Equal(t, remote.EngineStatus_VALID, payloadStatus.Status)
assert.Equal(t, chain.TopBlock.Hash(), headBlockHash)

// Point forkChoice to the head
forkChoiceMessage := engineapi.ForkChoiceMessage{
Expand Down