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
2 changes: 1 addition & 1 deletion internal/blocksync/ask_every_peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestReserveNextBlockPeers(t *testing.T) {
sync.AddPeer(newPeerData("late", 1, height))
require.NoError(t, sync.addBlock(BlockResponse{
PeerID: "first",
Block: &types.Block{Header: types.Header{Height: height}},
Height: height,
}))
require.Empty(t, next())
require.Empty(t, next())
Expand Down
4 changes: 2 additions & 2 deletions internal/blocksync/handover_deadline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (r *tipRun) consume(now time.Time) bool {
sync.peerStore.Update(req.peer.peerID, AddNumPending(-1), ResetFailures())
err := sync.addBlock(BlockResponse{
PeerID: req.peer.peerID,
Block: &types.Block{Header: types.Header{Height: req.height}},
Height: req.height,
})
if err != nil && !errors.Is(err, errDuplicateBlock) {
r.h.suite.Require().NoError(err)
Expand All @@ -109,7 +109,7 @@ func (r *tipRun) consume(now time.Time) bool {
if !ok {
break
}
sync.advance(r.blockTimes[resp.Block.Height], defaultPrecision)
sync.advance(r.blockTimes[resp.Height], defaultPrecision)
r.applied++
r.suppliedBy[resp.PeerID]++
}
Expand Down
2 changes: 1 addition & 1 deletion internal/blocksync/handover_late_supply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (r *lateSupplyRun) apply(peer PeerData, request *serviceRequest, height int
}
r.h.suite.Require().NoError(sync.addBlock(BlockResponse{
PeerID: peer.peerID,
Block: &types.Block{Header: types.Header{Height: height}},
Height: height,
}))
sync.advance(r.blockTimes[height], defaultPrecision)
r.served++
Expand Down
16 changes: 8 additions & 8 deletions internal/blocksync/synchronizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ func (h *waitForSyncHarness) tipBlocks(tipPeer types.NodeID, interval time.Durat
h.sync.AddPeer(newPeerData(tipPeer, 1, height))
h.suite.Require().NoError(h.sync.addBlock(BlockResponse{
PeerID: tipPeer,
Block: &types.Block{Header: types.Header{Height: height}},
Height: height,
}))
h.sync.advance(h.clock.Now(), defaultPrecision)
}
Expand Down Expand Up @@ -1968,13 +1968,13 @@ func (suite *SynchronizerTestSuite) TestWaitForSyncKeepsSyncingWhenASlowPeerReco
const run = maxCatchupGap + 1
first := b.produce(ctx)
suite.Require().NotNil(first)
suite.Require().EqualValues(1, first.Block.Height)
suite.Require().EqualValues(1, first.Height)
b.timeout(ctx, slow, 1)
responses := map[int64]*BlockResponse{}
for len(responses) < int(run) {
resp := b.produce(ctx)
suite.Require().NotNil(resp)
responses[resp.Block.Height] = resp
responses[resp.Height] = resp
}

h := suite.startWaitForSync(b.pool, clock)
Expand Down Expand Up @@ -2011,7 +2011,7 @@ func (suite *SynchronizerTestSuite) TestWaitForSyncKeepsSyncingBehindASoleSlowPe

resp := b.produce(ctx)
suite.Require().NotNil(resp)
suite.Require().EqualValues(1, resp.Block.Height)
suite.Require().EqualValues(1, resp.Height)
b.timeout(ctx, slow, 1)

h := suite.startWaitForSync(b.pool, fake)
Expand Down Expand Up @@ -2052,7 +2052,7 @@ func (suite *SynchronizerTestSuite) TestWaitForSyncKeepsSyncingBehindASlowPeerWi

resp := b.produce(ctx)
suite.Require().NotNil(resp)
suite.Require().EqualValues(1, resp.Block.Height)
suite.Require().EqualValues(1, resp.Height)
b.timeout(ctx, slow, 1)

h := suite.startWaitForSync(b.pool, fake)
Expand Down Expand Up @@ -2159,7 +2159,7 @@ func (h *waitForSyncHarness) flakySource(source types.NodeID, deliverEvery, fail
if elapsed%deliverEvery == 0 {
h.suite.Require().NoError(h.sync.addBlock(BlockResponse{
PeerID: source,
Block: &types.Block{Header: types.Header{Height: next}},
Height: next,
}))
// a block the network committed long ago
h.sync.advance(time.Time{}, defaultPrecision)
Expand Down Expand Up @@ -2462,7 +2462,7 @@ func (suite *SynchronizerTestSuite) TestWaitForSyncHandsOverPastAFarClaimFromAPe
h.sync.AddPeer(newPeerData(tipPeer, 1, next))
h.suite.Require().NoError(h.sync.addBlock(BlockResponse{
PeerID: relay,
Block: &types.Block{Header: types.Header{Height: next}},
Height: next,
}))
h.sync.advance(h.clock.Now(), defaultPrecision)
h.sync.peerStore.Update(relay, ResetFailures())
Expand Down Expand Up @@ -2520,7 +2520,7 @@ func (suite *SynchronizerTestSuite) TestWaitForSyncOnAFastChainBehindTheTip() {
next, _ := h.sync.GetStatus()
h.suite.Require().NoError(h.sync.addBlock(BlockResponse{
PeerID: source,
Block: &types.Block{Header: types.Header{Height: next}},
Height: next,
}))
h.sync.advance(last.Add(time.Duration(next-height+1)*interval), defaultPrecision)
h.sync.peerStore.Update(source, ResetFailures())
Expand Down
Loading