Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polygon/p2p: add request chunking to FetchHeaders #9536

Merged
merged 15 commits into from
Feb 29, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix windows test
  • Loading branch information
taratorio committed Feb 27, 2024
commit c574e056e5baafc1e397d3933565ed1bde36e7ba
2 changes: 1 addition & 1 deletion polygon/p2p/peer_sync_progress.go
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ type peerSyncProgress struct {
func (psp *peerSyncProgress) blockNumPresent(blockNum uint64) {
if psp.minMissingBlockNum <= blockNum {
psp.minMissingBlockNum = 0
psp.minMissingBlockNumTs = time.Unix(0, 0)
psp.minMissingBlockNumTs = time.Time{}
}
}

3 changes: 2 additions & 1 deletion polygon/p2p/peer_sync_progress_test.go
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ package p2p

import (
"testing"
"time"

"github.com/stretchr/testify/require"
)
@@ -25,7 +26,7 @@ func TestPeerMayHaveBlockNum(t *testing.T) {
require.False(t, psp.peerMayHaveBlockNum(1_000))

// expired timestamp
psp.minMissingBlockNumTs = psp.minMissingBlockNumTs.Add(-missingBlockNumExpiry)
psp.minMissingBlockNumTs = psp.minMissingBlockNumTs.Add(-missingBlockNumExpiry).Add(-time.Second)
require.True(t, psp.peerMayHaveBlockNum(0))
require.True(t, psp.peerMayHaveBlockNum(200))
require.True(t, psp.peerMayHaveBlockNum(500))
Loading