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
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
using Nethermind.Core;
using Nethermind.Core.Test.Builders;
using Nethermind.Core.Test.Modules;
using Nethermind.Network.Config;
using Nethermind.State;
using Nethermind.Synchronization.FastSync;
using Nethermind.Synchronization.ParallelSync;
using Nethermind.Synchronization.Peers;
using NSubstitute;
using NUnit.Framework;

Expand Down Expand Up @@ -52,4 +54,21 @@ public async Task TestOnTreeSyncFinish_CallVisit()
.Received(1)
.VerifyTrie(Arg.Any<BlockHeader>(), Arg.Any<CancellationToken>());
}

[Test]
public void SyncPeerPool_should_use_INetworkConfig_MaxActivePeers()
{
NetworkConfig networkConfig = new() { MaxActivePeers = 75 };

using IContainer container = new ContainerBuilder()
.AddModule(new TestNethermindModule(networkConfig))
.AddModule(new SynchronizerModule(new TestSyncConfig()))
.AddSingleton(Substitute.For<ITreeSync>())
.AddSingleton(Substitute.For<IWorldStateManager>())
.Build();

SyncPeerPool pool = container.Resolve<SyncPeerPool>();

Assert.That(pool.PeerMaxCount, Is.EqualTo(75));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Nethermind.Blockchain.Synchronization;
using Nethermind.Consensus.Validators;
using Nethermind.Core;
using Nethermind.Core.Container;
using Nethermind.Core.Crypto;
using Nethermind.Core.Extensions;
using Nethermind.Int256;
Expand Down Expand Up @@ -61,6 +62,7 @@ public class SyncPeerPool : ISyncPeerPool, IPeerDifficultyRefreshPool
private readonly TimeSpan _timeBeforeWakingShallowSleepingPeerUp = TimeSpan.FromMilliseconds(DefaultUpgradeIntervalInMs);
private Timer? _upgradeTimer;

[UseConstructorForDependencyInjection]
public SyncPeerPool(IBlockTree blockTree,
INodeStatsManager nodeStatsManager,
IBetterPeerStrategy betterPeerStrategy,
Expand Down