mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 20:37:17 +00:00
remove redundant start slot (#7991)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
parent
387f7b28c1
commit
c7f7a29d7e
@ -62,7 +62,6 @@ type syncMode uint8
|
||||
type blocksQueueConfig struct {
|
||||
blocksFetcher *blocksFetcher
|
||||
chain blockchainService
|
||||
startSlot uint64
|
||||
highestExpectedSlot uint64
|
||||
p2p p2p.P2P
|
||||
db db.ReadOnlyDatabase
|
||||
@ -106,7 +105,7 @@ func newBlocksQueue(ctx context.Context, cfg *blocksQueueConfig) *blocksQueue {
|
||||
})
|
||||
}
|
||||
highestExpectedSlot := cfg.highestExpectedSlot
|
||||
if highestExpectedSlot <= cfg.startSlot {
|
||||
if highestExpectedSlot == 0 {
|
||||
if cfg.mode == modeStopOnFinalizedEpoch {
|
||||
highestExpectedSlot = blocksFetcher.bestFinalizedSlot()
|
||||
} else {
|
||||
|
@ -129,36 +129,6 @@ func TestBlocksQueue_InitStartStop(t *testing.T) {
|
||||
cancel()
|
||||
assert.NoError(t, queue.stop())
|
||||
})
|
||||
|
||||
t.Run("start is higher than expected slot", func(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
p := p2pt.NewTestP2P(t)
|
||||
connectPeers(t, p, []*peerData{
|
||||
{blocks: makeSequence(500, 628), finalizedEpoch: 16, headSlot: 600},
|
||||
}, p.Peers())
|
||||
fetcher := newBlocksFetcher(ctx, &blocksFetcherConfig{
|
||||
chain: mc,
|
||||
p2p: p,
|
||||
})
|
||||
// Mode 1: stop on finalized.
|
||||
queue := newBlocksQueue(ctx, &blocksQueueConfig{
|
||||
blocksFetcher: fetcher,
|
||||
chain: mc,
|
||||
highestExpectedSlot: blockBatchLimit,
|
||||
startSlot: 128,
|
||||
})
|
||||
assert.Equal(t, uint64(512), queue.highestExpectedSlot)
|
||||
// Mode 2: unconstrained.
|
||||
queue = newBlocksQueue(ctx, &blocksQueueConfig{
|
||||
blocksFetcher: fetcher,
|
||||
chain: mc,
|
||||
highestExpectedSlot: blockBatchLimit,
|
||||
startSlot: 128,
|
||||
mode: modeNonConstrained,
|
||||
})
|
||||
assert.Equal(t, uint64(576), queue.highestExpectedSlot)
|
||||
})
|
||||
}
|
||||
|
||||
func TestBlocksQueue_Loop(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user