Dispose Alltxstore
MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -53,7 +53,7 @@ namespace WalletWasabi.Tests.IntegrationTests
var dataDir = Common.GetWorkDir();
var indexStore = new IndexStore(Path.Combine(dataDir, "indexStore"), network, new SmartHeaderChain());
- var transactionStore = new AllTransactionStore(Path.Combine(dataDir, "transactionStore"), network);
+ 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 BitcoinStore(indexStore, transactionStore, mempoolService, blocks);

MODIFY
WalletWasabi.Tests/UnitTests/Transactions/AllTransactionStoreTests.cs
WalletWasabi.Tests/UnitTests/Transactions/AllTransactionStoreTests.cs
@@ -76,7 +76,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
public async Task CanInitializeEmptyAsync(Network network)
{
var dir = PrepareWorkDir();
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
Assert.NotNull(txStore.ConfirmedStore);
@@ -136,7 +136,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
await File.WriteAllLinesAsync(mempoolFile, mempoolFileContent);
await File.WriteAllLinesAsync(txFile, txFileContent);
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
Assert.Equal(6, txStore.GetTransactions().Count());
@@ -194,7 +194,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
await File.WriteAllLinesAsync(mempoolFile, mempoolFileContent);
await File.WriteAllLinesAsync(txFile, txFileContent);
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
Assert.Equal(6, txStore.GetTransactions().Count());
@@ -229,7 +229,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
await File.WriteAllLinesAsync(mempoolFile, mempoolFileContent);
await File.WriteAllLinesAsync(txFile, txFileContent);
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
Assert.Equal(6, txStore.GetTransactions().Count());
@@ -267,7 +267,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
await File.WriteAllLinesAsync(mempoolFile, mempoolFileContent);
await File.WriteAllLinesAsync(txFile, txFileContent);
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
Assert.Equal(6, txStore.GetTransactions().Count());
@@ -308,11 +308,6 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
await File.WriteAllLinesAsync(mempoolFile, mempoolFileContent);
await File.WriteAllLinesAsync(txFile, txFileContent);
- var txStore = new AllTransactionStore(dir, network);
- await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
-
- var txs = txStore.GetTransactions();
- var txHashes = txStore.GetTransactionHashes();
var expectedArray = new[]
{
uTx1,
@@ -323,10 +318,19 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
cTx3
}.OrderByBlockchain().ToList();
+ await using (var txStore = new AllTransactionStore(dir, network))
+ {
+ await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
+
+ var txs = txStore.GetTransactions();
+ var txHashes = txStore.GetTransactionHashes();
+
Assert.Equal(txHashes, txs.Select(x => x.GetHash()));
Assert.Equal(expectedArray, txs);
+ }
- txStore = new AllTransactionStore(PrepareWorkDir(), network);
+ await using (var txStore = new AllTransactionStore(PrepareWorkDir(), network))
+ {
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
txStore.AddOrUpdate(uTx3);
@@ -336,18 +340,19 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
txStore.AddOrUpdate(cTx1);
txStore.AddOrUpdate(cTx2);
- txs = txStore.GetTransactions();
- txHashes = txStore.GetTransactionHashes();
+ var txs = txStore.GetTransactions();
+ var txHashes = txStore.GetTransactionHashes();
Assert.Equal(txHashes, txs.Select(x => x.GetHash()));
Assert.Equal(expectedArray, txs);
}
+ }
[Theory]
[MemberData(nameof(GetDifferentNetworkValues))]
public async Task DoesntUpdateAsync(Network network)
{
- var txStore = new AllTransactionStore(PrepareWorkDir(), network);
+ await using var txStore = new AllTransactionStore(PrepareWorkDir(), network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
var tx = Common.RandomSmartTransaction();
@@ -400,7 +405,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
await File.WriteAllLinesAsync(mempoolFile, mempoolFileContent);
await File.WriteAllLinesAsync(txFile, txFileContent);
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
// Two transactions are in the mempool store and unconfirmed.
@@ -446,7 +451,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
string dir = PrepareWorkDir();
var network = Network.Main;
- var txStore = new AllTransactionStore(dir, network);
+ await using var txStore = new AllTransactionStore(dir, network);
await txStore.InitializeAsync(ensureBackwardsCompatibility: false);
foreach (var height in Enumerable.Range(1, blocks))

MODIFY
WalletWasabi/Stores/BitcoinStore.cs
WalletWasabi/Stores/BitcoinStore.cs
@@ -62,6 +62,7 @@ namespace WalletWasabi.Stores
public async ValueTask DisposeAsync()
{
await IndexStore.DisposeAsync().ConfigureAwait(false);
+ await TransactionStore.DisposeAsync().ConfigureAwait(false);
}
}
}

Dispose Alltxstore