diff --git a/src/Lantern.Beacon/BeaconClientManager.cs b/src/Lantern.Beacon/BeaconClientManager.cs index 5b534dc..af063b4 100644 --- a/src/Lantern.Beacon/BeaconClientManager.cs +++ b/src/Lantern.Beacon/BeaconClientManager.cs @@ -403,7 +403,7 @@ private async Task MonitorSyncStatus(CancellationToken token) peer.Address.Get().Value.ToString(), peer.Address.Get().Value.ToString(), peer.Address.Get().Value.ToString()); - + peerState.BootstrapPeers.TryRemove(peer.Address.GetPeerId()!, out _); await DialPeerWithProtocol(peer, token); } diff --git a/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs b/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs index a43ce6d..e471693 100644 --- a/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs +++ b/test/Lantern.Beacon.Tests/BeaconClientManagerTests.cs @@ -455,7 +455,7 @@ public async Task DialPeer_ShouldReturnIfPeerAddressIsNull() [Test] public async Task DialPeer_ShouldSaveValidPeerAsLivePeer() { - var clientOptions = new BeaconClientOptions { EnableDiscovery = false, TargetPeerCount = 1, DialTimeoutSeconds = 1}; + var clientOptions = new BeaconClientOptions { EnableDiscovery = false, TargetPeerCount = 1, DialTimeoutSeconds = 10}; var multiAddress = new Multiaddress().Add("0.0.0.0").Add(0); var mockRemotePeer = new Mock(); var syncOptions = new SyncProtocolOptions() { GenesisValidatorsRoot = new byte[32], GenesisTime = 1606824023, Preset = SizePreset.MainnetPreset }; @@ -480,6 +480,7 @@ public async Task DialPeer_ShouldSaveValidPeerAsLivePeer() _mockPeerState.Setup(x => x.BootstrapPeers).Returns(new ConcurrentDictionary()); _mockPeerState.Setup(x => x.PeerProtocols).Returns(peerProtocols); _mockSyncProtocol.Setup(x => x.DenebLightClientStore).Returns(denebLightClientStore); + _mockSyncProtocol.Setup(x => x.IsInitialised).Returns(true); _mockSyncProtocol.Setup(x => x.Options).Returns(syncOptions); _beaconClientManager = new BeaconClientManager(clientOptions, _mockManualDiscoveryProtocol.Object, _mockLiteDbService.Object, _mockCustomDiscoveryProtocol.Object, _mockPeerState.Object, _mockSyncProtocol.Object, _mockPeerFactory.Object, _mockIdentityManager.Object, _mockLoggerFactory.Object);