Skip to content

Commit

Permalink
Fix failing Autofac and context with mocks test
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgreg committed Feb 13, 2025
1 parent 1b4c4f4 commit 92988d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ protected override void Load(ContainerBuilder builder)
// This load from file.
.AddSingleton<NodesLoader>()

.AddSingleton<ITrustedNodesManager, ILogManager>((logManager) =>
new TrustedNodesManager(initConfig.TrustedNodesPath, logManager))

.Bind<INodeSource, IStaticNodesManager>()
.Bind<INodeSource, NodesLoader>()
.AddComposite<INodeSource, CompositeNodeSource>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,10 @@ public async IAsyncEnumerable<Node> DiscoverNodes([EnumeratorCancellation] Cance
yield return new Node(netNode) { IsTrusted = true };
}

// continuously yield new nodes as they are added via the channel.
while (await _nodeChannel.Reader.WaitToReadAsync(cancellationToken))
// yield new nodes as they are added via the channel
await foreach (Node node in _nodeChannel.Reader.ReadAllAsync(cancellationToken))
{
while (_nodeChannel.Reader.TryRead(out Node node))
{
yield return node;
}
yield return node;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static NethermindApi ContextWithMocks()
RewardCalculatorSource = Substitute.For<IRewardCalculatorSource>(),
TxPoolInfoProvider = Substitute.For<ITxPoolInfoProvider>(),
StaticNodesManager = Substitute.For<IStaticNodesManager>(),
TrustedNodesManager = Substitute.For<ITrustedNodesManager>(),
BloomStorage = Substitute.For<IBloomStorage>(),
Sealer = Substitute.For<ISealer>(),
BlockchainProcessor = Substitute.For<IBlockchainProcessor>(),
Expand Down

0 comments on commit 92988d6

Please sign in to comment.