From 91a77c25a25379f1bfcc9296fa6846cc502e9c7d Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 6 Mar 2023 18:28:47 +0300 Subject: [PATCH] network: refactor blockqueuer interface Remove unused argument. --- pkg/network/blockqueue.go | 2 +- pkg/network/blockqueue_test.go | 2 +- pkg/network/server.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/network/blockqueue.go b/pkg/network/blockqueue.go index 5927b72f7..15e325dfd 100644 --- a/pkg/network/blockqueue.go +++ b/pkg/network/blockqueue.go @@ -37,7 +37,7 @@ func indexToPosition(i uint32) int { return int(i) % blockCacheSize } -func newBlockQueue(capacity int, bc Blockqueuer, log *zap.Logger, relayer func(*block.Block)) *blockQueue { +func newBlockQueue(bc Blockqueuer, log *zap.Logger, relayer func(*block.Block)) *blockQueue { if log == nil { return nil } diff --git a/pkg/network/blockqueue_test.go b/pkg/network/blockqueue_test.go index 642ba8ccd..2427356b5 100644 --- a/pkg/network/blockqueue_test.go +++ b/pkg/network/blockqueue_test.go @@ -13,7 +13,7 @@ import ( func TestBlockQueue(t *testing.T) { chain := fakechain.NewFakeChain() // notice, it's not yet running - bq := newBlockQueue(0, chain, zaptest.NewLogger(t), nil) + bq := newBlockQueue(chain, zaptest.NewLogger(t), nil) blocks := make([]*block.Block, 11) for i := 1; i < 11; i++ { blocks[i] = &block.Block{Header: block.Header{Index: uint32(i)}} diff --git a/pkg/network/server.go b/pkg/network/server.go index 112ab56f4..f7d94b95e 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -204,11 +204,11 @@ func newServerFromConstructors(config ServerConfig, chain Ledger, stSync StateSy }, s.notaryFeer) }) } - s.bQueue = newBlockQueue(maxBlockBatch, chain, log, func(b *block.Block) { + s.bQueue = newBlockQueue(chain, log, func(b *block.Block) { s.tryStartServices() }) - s.bSyncQueue = newBlockQueue(maxBlockBatch, s.stateSync, log, nil) + s.bSyncQueue = newBlockQueue(s.stateSync, log, nil) if s.MinPeers < 0 { s.log.Info("bad MinPeers configured, using the default value",