From 60bda34a66dc73030d49cfdcda2e197e770b5939 Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Fri, 30 Jun 2023 12:12:39 +0200 Subject: [PATCH] rename(p2p): rename minUntrustedHeadRequests -> numUntrustedHeadRequests --- p2p/exchange.go | 8 ++++---- p2p/exchange_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/p2p/exchange.go b/p2p/exchange.go index 0d21faf3..8cde9d7e 100644 --- a/p2p/exchange.go +++ b/p2p/exchange.go @@ -27,9 +27,9 @@ var log = logging.Logger("header/p2p") // chosen. const minHeadResponses = 2 -// minUntrustedHeadRequests is the minimum number of head requests to be made to +// numUntrustedHeadRequests is the number of head requests to be made to // the network in order to determine the network head. -var minUntrustedHeadRequests = 4 +var numUntrustedHeadRequests = 4 // Exchange enables sending outbound HeaderRequests to the network as well as // handling inbound HeaderRequests from the network. @@ -132,11 +132,11 @@ func (ex *Exchange[H]) Head(ctx context.Context, reqOpts ...RequestOption) (H, e } peers := ex.peerTracker.GetPeers() - if reqParams.SubjectiveInit || len(peers) < minUntrustedHeadRequests { + if reqParams.SubjectiveInit || len(peers) < numUntrustedHeadRequests { peers = ex.trustedPeers() } else { // only query a subset - peers = peers[:minUntrustedHeadRequests] + peers = peers[:numUntrustedHeadRequests] } var ( diff --git a/p2p/exchange_test.go b/p2p/exchange_test.go index a676798e..60a97d01 100644 --- a/p2p/exchange_test.go +++ b/p2p/exchange_test.go @@ -34,7 +34,7 @@ func TestExchange_RequestHead(t *testing.T) { // decrease the minimum number of untrusted peers to request head from // for testing purposes - minUntrustedHeadRequests = 2 + numUntrustedHeadRequests = 2 hosts := createMocknet(t, 3) exchg, trustedStore := createP2PExAndServer(t, hosts[0], hosts[1])