`AllTransactionStore` & `IndexStore`: Move path arguments from `InitializeAsync`s to constructors
MODIFY
WalletWasabi/Blockchain/Transactions/AllTransactionStore.cs
WalletWasabi/Blockchain/Transactions/AllTransactionStore.cs
@@ -14,8 +14,11 @@ namespace WalletWasabi.Blockchain.Transactions
{
public class AllTransactionStore
{
- public AllTransactionStore(Network network)
+ public AllTransactionStore(string workFolderPath, Network network)
{
+ WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
+ IoHelpers.EnsureDirectoryExists(WorkFolderPath);
+
Network = Guard.NotNull(nameof(network), network);
}
@@ -28,12 +31,10 @@ namespace WalletWasabi.Blockchain.Transactions
public TransactionStore ConfirmedStore { get; private set; }
private object Lock { get; set; }
- public async Task InitializeAsync(string workFolderPath, bool ensureBackwardsCompatibility = true)
+ public async Task InitializeAsync(bool ensureBackwardsCompatibility = true)
{
using (BenchmarkLogger.Measure())
{
- WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
- IoHelpers.EnsureDirectoryExists(WorkFolderPath);
MempoolStore = new TransactionStore();
ConfirmedStore = new TransactionStore();
Lock = new object();

MODIFY
WalletWasabi/Stores/IndexStore.cs
WalletWasabi/Stores/IndexStore.cs
@@ -23,8 +23,11 @@ namespace WalletWasabi.Stores
/// </summary>
public class IndexStore
{
- public IndexStore(Network network, SmartHeaderChain hashChain)
+ public IndexStore(string workFolderPath, Network network, SmartHeaderChain hashChain)
{
+ WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
+ IoHelpers.EnsureDirectoryExists(WorkFolderPath);
+
Network = Guard.NotNull(nameof(network), network);
SmartHeaderChain = Guard.NotNull(nameof(hashChain), hashChain);
}
@@ -46,12 +49,10 @@ namespace WalletWasabi.Stores
private List<FilterModel> ImmatureFilters { get; set; }
private AsyncLock IndexLock { get; set; }
- public async Task InitializeAsync(string workFolderPath)
+ public async Task InitializeAsync()
{
using (BenchmarkLogger.Measure())
{
- WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
- IoHelpers.EnsureDirectoryExists(WorkFolderPath);
var indexFilePath = Path.Combine(WorkFolderPath, "MatureIndex.dat");
MatureIndexFileManager = new DigestableSafeMutexIoManager(indexFilePath, digestRandomIndex: -1);
var immatureIndexFilePath = Path.Combine(WorkFolderPath, "ImmatureIndex.dat");

`AllTransactionStore` & `IndexStore`: Move path arguments from `InitializeAsync`s to constructors

(cherry picked from commit 62c2525b25d4a084d9459b8c142c9df8e710ddb5)