Remove CachedBlockProvider as it is a dummy encapsulation
MODIFY
WalletWasabi.Fluent/Global.cs
WalletWasabi.Fluent/Global.cs
@@ -189,7 +189,7 @@ public class Global
await StartRpcServerAsync(terminateService, cancel).ConfigureAwait(false);
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(BitcoinStore.BlockRepository),
+ BitcoinStore.BlockRepository,
new LocalBlockProvider(BitcoinCoreNode, HttpClientFactory, Config.ServiceConfiguration, Network),
new P2pBlockProvider(HostedServices.Get<P2pNetwork>().Nodes, HttpClientFactory, Config.ServiceConfiguration, Network),
Cache);

MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -107,7 +107,7 @@ public class P2pTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfig, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfig, network),
cache);

MODIFY
WalletWasabi.Tests/RegressionTests/BuildTests.cs
WalletWasabi.Tests/RegressionTests/BuildTests.cs
@@ -68,7 +68,7 @@ public class BuildTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfiguration, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfiguration, network),
cache);
@@ -229,7 +229,7 @@ public class BuildTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfiguration, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfiguration, network),
cache);

MODIFY
WalletWasabi.Tests/RegressionTests/SendTests.cs
WalletWasabi.Tests/RegressionTests/SendTests.cs
@@ -67,7 +67,7 @@ public class SendTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfiguration, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfiguration, network),
cache);
@@ -553,7 +553,7 @@ public class SendTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfiguration, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfiguration, network),
cache);
@@ -735,7 +735,7 @@ public class SendTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfiguration, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfiguration, network),
cache);

MODIFY
WalletWasabi.Tests/RegressionTests/WalletTests.cs
WalletWasabi.Tests/RegressionTests/WalletTests.cs
@@ -255,7 +255,7 @@ public class WalletTests
});
var blockProvider = new SmartBlockProvider(
- new CachedBlockProvider(bitcoinStore.BlockRepository),
+ bitcoinStore.BlockRepository,
new LocalBlockProvider(null, httpClientFactory, serviceConfiguration, network),
new P2pBlockProvider(nodes, httpClientFactory, serviceConfiguration, network),
cache);

DELETE
WalletWasabi/Wallets/CachedBlockProvider.cs
-using NBitcoin;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace WalletWasabi.Wallets;
-
-/// <summary>
-/// CachedBlockProvider is a blocks provider that keeps the blocks on a repository to satisfy future requests.
-/// </summary>
-public class CachedBlockProvider : IBlockProvider
-{
- public CachedBlockProvider(IRepository<uint256, Block> blockRepository)
- {
- BlockRepository = blockRepository;
- }
-
- public IRepository<uint256, Block> BlockRepository { get; }
-
- /// <summary>
- /// Gets a bitcoin block. In case the requested block is not available in the repository it is returned
- /// immediately to the caller; otherwise it obtains the block from the source provider and stores it in
- /// the repository to satisfy future requests.
- /// </summary>
- /// <param name="hash">The block's hash that identifies the requested block.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>The requested bitcoin block.</returns>
- public async Task<Block?> TryGetBlockAsync(uint256 hash, CancellationToken cancellationToken)
- {
- return await BlockRepository.TryGetAsync(hash, cancellationToken).ConfigureAwait(false);
- }
-
- public async Task SaveBlockAsync(Block block, CancellationToken cancellationToken)
- {
- await BlockRepository.SaveAsync(block, cancellationToken).ConfigureAwait(false);
- }
-
- /// <summary>
- /// Removes the specified block from the cache repository.
- /// </summary>
- /// <param name="hash">The block's hash that identifies the requested block.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>The requested bitcoin block.</returns>
- public Task InvalidateAsync(uint256 hash, CancellationToken cancellationToken)
- {
- return BlockRepository.RemoveAsync(hash, cancellationToken);
- }
-}

Remove CachedBlockProvider as it is a dummy encapsulation