From c9a546c310d82eb00e0e76a5e73d2ff7d601f8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 3 Jun 2015 14:39:21 +0300 Subject: eth/downloader: add a basic block download congestion control --- eth/downloader/queue_test.go | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'eth/downloader/queue_test.go') diff --git a/eth/downloader/queue_test.go b/eth/downloader/queue_test.go index b1f3591f3..ee6141f71 100644 --- a/eth/downloader/queue_test.go +++ b/eth/downloader/queue_test.go @@ -1,8 +1,6 @@ package downloader import ( - "testing" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "gopkg.in/fatih/set.v0" @@ -30,32 +28,3 @@ func createBlocksFromHashSet(hashes *set.Set) []*types.Block { return blocks } - -func TestChunking(t *testing.T) { - queue := newQueue() - peer1 := newPeer("peer1", common.Hash{}, nil, nil) - peer2 := newPeer("peer2", common.Hash{}, nil, nil) - - // 99 + 1 (1 == known genesis hash) - hashes := createHashes(0, 99) - queue.Insert(hashes) - - chunk1 := queue.Reserve(peer1, 99) - if chunk1 == nil { - t.Errorf("chunk1 is nil") - t.FailNow() - } - chunk2 := queue.Reserve(peer2, 99) - if chunk2 == nil { - t.Errorf("chunk2 is nil") - t.FailNow() - } - - if len(chunk1.Hashes) != 99 { - t.Error("expected chunk1 hashes to be 99, got", len(chunk1.Hashes)) - } - - if len(chunk2.Hashes) != 1 { - t.Error("expected chunk1 hashes to be 1, got", len(chunk2.Hashes)) - } -} -- cgit v1.2.3