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
5 changes: 4 additions & 1 deletion src/Nethermind/Nethermind.Xdc/XdcModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
using Nethermind.Xdc.TxPool;
using Nethermind.Api.Steps;
using Nethermind.Synchronization;
using Nethermind.Synchronization.FastSync;
using Nethermind.Synchronization.ParallelSync;

namespace Nethermind.Xdc;

Expand Down Expand Up @@ -88,8 +90,9 @@ protected override void Load(ContainerBuilder builder)
.AddSingleton<ITimeoutTimer, TimeoutTimer>()
.AddSingleton<ISyncInfoManager, SyncInfoManager>()

// beacon sync strategy
// sync
.AddSingleton<IBeaconSyncStrategy, XdcBeaconSyncStrategy>()
.AddSingleton<IPeerAllocationStrategyFactory<StateSyncBatch>, XdcStateSyncAllocationStrategyFactory>()

.AddSingleton<IBlockProducerTxSourceFactory, XdcTxPoolTxSourceFactory>()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Stats;
using Nethermind.Synchronization.FastSync;
using Nethermind.Synchronization.ParallelSync;
using Nethermind.Synchronization.Peers;
using Nethermind.Synchronization.Peers.AllocationStrategies;
using Nethermind.Synchronization.StateSync;

namespace Nethermind.Xdc;

public class XdcStateSyncAllocationStrategyFactory : StaticPeerAllocationStrategyFactory<StateSyncBatch>
{
private static readonly IPeerAllocationStrategy DefaultStrategy =
new AllocationStrategy(new BySpeedStrategy(TransferSpeedType.NodeData, true));

public XdcStateSyncAllocationStrategyFactory() : base(DefaultStrategy)
{
}

internal class AllocationStrategy : FilterPeerAllocationStrategy
{
public AllocationStrategy(IPeerAllocationStrategy strategy) : base(strategy)
{
}

protected override bool Filter(PeerInfo peerInfo)
{
return peerInfo.CanGetSnapData() || peerInfo.SyncPeer.ProtocolVersion == 100;
}
}
}