`BitcoinStore`: No longer `IAsyncDisposable`.
MODIFY
WalletWasabi.Fluent/Global.cs
WalletWasabi.Fluent/Global.cs
@@ -57,7 +57,7 @@ public class Global
public TransactionBroadcaster TransactionBroadcaster { get; set; }
public CoinJoinProcessor CoinJoinProcessor { get; set; }
private TorProcessManager? TorManager { get; set; }
- public CoreNode BitcoinCoreNode { get; private set; }
+ public CoreNode? BitcoinCoreNode { get; private set; }
public HostedServices HostedServices { get; }
public UiConfig UiConfig { get; }
@@ -68,6 +68,8 @@ public class Global
public JsonRpcServer? RpcServer { get; private set; }
private PersonCircuit RoundStateUpdaterCircuit { get; }
+ private AllTransactionStore AllTransactionStore { get; }
+ private IndexStore IndexStore { get; }
public Global(string dataDir, Config config, UiConfig uiConfig, WalletManager walletManager)
{
@@ -82,12 +84,12 @@ public class Global
WalletManager = walletManager;
var networkWorkFolderPath = Path.Combine(DataDir, "BitcoinStore", Network.ToString());
- var transactionStore = new AllTransactionStore(networkWorkFolderPath, Network);
- var indexStore = new IndexStore(Path.Combine(networkWorkFolderPath, "IndexStore"), Network, new SmartHeaderChain());
+ AllTransactionStore = new AllTransactionStore(networkWorkFolderPath, Network);
+ IndexStore = new IndexStore(Path.Combine(networkWorkFolderPath, "IndexStore"), Network, new SmartHeaderChain());
var mempoolService = new MempoolService();
var blocks = new FileSystemBlockRepository(Path.Combine(networkWorkFolderPath, "Blocks"), Network);
- BitcoinStore = new BitcoinStore(indexStore, transactionStore, mempoolService, blocks);
+ BitcoinStore = new BitcoinStore(IndexStore, AllTransactionStore, mempoolService, blocks);
if (Config.UseTor)
{
@@ -401,8 +403,11 @@ public class Global
try
{
- await BitcoinStore.DisposeAsync().ConfigureAwait(false);
- Logger.LogInfo($"{nameof(BitcoinStore)} is disposed.");
+ await IndexStore.DisposeAsync().ConfigureAwait(false);
+ Logger.LogInfo($"{nameof(IndexStore)} is disposed.");
+
+ await AllTransactionStore.DisposeAsync().ConfigureAwait(false);
+ Logger.LogInfo($"{nameof(AllTransactionStore)} is disposed.");
}
catch (Exception ex)
{

MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -53,11 +53,11 @@ public class P2pTests
var dataDir = Common.GetWorkDir();
- var indexStore = new IndexStore(Path.Combine(dataDir, "indexStore"), network, new SmartHeaderChain());
+ await using var indexStore = new IndexStore(Path.Combine(dataDir, "indexStore"), network, new SmartHeaderChain());
await using var transactionStore = new AllTransactionStore(Path.Combine(dataDir, "transactionStore"), network);
var mempoolService = new MempoolService();
var blocks = new FileSystemBlockRepository(Path.Combine(dataDir, "blocks"), network);
- await using BitcoinStore bitcoinStore = new(indexStore, transactionStore, mempoolService, blocks);
+ BitcoinStore bitcoinStore = new(indexStore, transactionStore, mempoolService, blocks);
await bitcoinStore.InitializeAsync();
var addressManagerFolderPath = Path.Combine(dataDir, "AddressManager");
@@ -167,8 +167,6 @@ public class P2pTests
IoHelpers.EnsureContainingDirectoryExists(addressManagerFilePath);
addressManager?.SavePeerFile(addressManagerFilePath, network);
Logger.LogInfo($"Saved {nameof(AddressManager)} to `{addressManagerFilePath}`.");
-
- await bitcoinStore.DisposeAsync();
}
}
}

MODIFY
WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs
WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs
@@ -40,7 +40,7 @@ public class P2pBasedTests
FileSystemBlockRepository blocks = new(Path.Combine(dir, "blocks"), network);
// Construct BitcoinStore.
- await using BitcoinStore bitcoinStore = new(indexStore, transactionStore, mempoolService, blocks);
+ BitcoinStore bitcoinStore = new(indexStore, transactionStore, mempoolService, blocks);
await bitcoinStore.InitializeAsync();
await rpc.GenerateAsync(blockCount: 101);

MODIFY
WalletWasabi/Stores/BitcoinStore.cs
WalletWasabi/Stores/BitcoinStore.cs
@@ -14,8 +14,10 @@ namespace WalletWasabi.Stores;
/// The purpose of this class is to safely and efficiently manage all the Bitcoin related data
/// that's being serialized to disk, like transactions, wallet files, keys, blocks, index files, etc.
/// </summary>
-public class BitcoinStore : IAsyncDisposable
+public class BitcoinStore
{
+ /// <param name="indexStore">Not initialized index store.</param>
+ /// <param name="transactionStore">Not initialized transaction store.</param>
public BitcoinStore(
IndexStore indexStore,
AllTransactionStore transactionStore,
@@ -53,10 +55,4 @@ public class BitcoinStore : IAsyncDisposable
await Task.WhenAll(initTasks).ConfigureAwait(false);
}
}
-
- public async ValueTask DisposeAsync()
- {
- await IndexStore.DisposeAsync().ConfigureAwait(false);
- await TransactionStore.DisposeAsync().ConfigureAwait(false);
- }
}

`BitcoinStore`: No longer `IAsyncDisposable`.