WalletService should get work folder instead of BlocksFolder
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -35,7 +35,6 @@ namespace WalletWasabi.Gui
}
public static string WalletsDir => Path.Combine(DataDir, "Wallets");
- public static string BlocksDir => Path.Combine(DataDir, "Blocks", Config.Network.ToString());
public static Network Network => Config.Network;
public static BlindingRsaPubKey BlindingPubKey => Config.GetBlindingRsaPubKey();
@@ -143,7 +142,7 @@ namespace WalletWasabi.Gui
public static async Task InitializeWalletServiceAsync(KeyManager keyManager)
{
ChaumianClient = new CcjClient(Network, BlindingPubKey, keyManager, Config.GetCurrentBackendUri());
- WalletService = new WalletService(keyManager, IndexDownloader, ChaumianClient, MemPoolService, Nodes, BlocksDir);
+ WalletService = new WalletService(keyManager, IndexDownloader, ChaumianClient, MemPoolService, Nodes, DataDir);
ChaumianClient.Start();
Logger.LogInfo("Start Chaumian CoinJoin service...");

MODIFY
WalletWasabi.Tests/P2pTests.cs
WalletWasabi.Tests/P2pTests.cs
@@ -56,7 +56,7 @@ namespace WalletWasabi.Tests
var addressManagerFolderPath = Path.Combine(SharedFixture.DataDir, "AddressManager");
var addressManagerFilePath = Path.Combine(addressManagerFolderPath, $"AddressManager{network}.dat");
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, $"Blocks{network}");
+ var blocksFolderPath = Path.Combine(SharedFixture.DataDir, "Blocks", network.ToString());
var connectionParameters = new NodeConnectionParameters();
AddressManager addressManager = null;
try
@@ -95,7 +95,7 @@ namespace WalletWasabi.Tests
new CcjClient(network, new BlindingRsaKey().PubKey, keyManager, new Uri("http://localhost:12345")),
memPoolService,
nodes,
- blocksFolderPath);
+ SharedFixture.DataDir);
Assert.True(Directory.Exists(blocksFolderPath));
try

MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -453,8 +453,8 @@ namespace WalletWasabi.Tests
var chaumianClient = new CcjClient(rpc.Network, coordinator.RsaKey.PubKey, keyManager, new Uri(RegTestFixture.BackendEndPoint));
// 5. Create wallet service.
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, nameof(WalletTestsAsync), $"Blocks");
- var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, blocksFolderPath);
+ var workDir = Path.Combine(SharedFixture.DataDir, nameof(WalletTestsAsync));
+ var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, workDir);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
// Get some money, make it confirm.
@@ -687,8 +687,8 @@ namespace WalletWasabi.Tests
var chaumianClient = new CcjClient(rpc.Network, coordinator.RsaKey.PubKey, keyManager, new Uri(RegTestFixture.BackendEndPoint));
// 6. Create wallet service.
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync), $"Blocks");
- var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, blocksFolderPath);
+ var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
+ var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, workDir);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
// Get some money, make it confirm.
@@ -1129,8 +1129,8 @@ namespace WalletWasabi.Tests
var chaumianClient = new CcjClient(rpc.Network, coordinator.RsaKey.PubKey, keyManager, new Uri(RegTestFixture.BackendEndPoint));
// 6. Create wallet service.
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync), $"Blocks");
- var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, blocksFolderPath);
+ var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
+ var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, workDir);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
var scp = new Key().ScriptPubKey;
@@ -1299,8 +1299,8 @@ namespace WalletWasabi.Tests
var chaumianClient = new CcjClient(rpc.Network, coordinator.RsaKey.PubKey, keyManager, new Uri(RegTestFixture.BackendEndPoint));
// 6. Create wallet service.
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync), $"Blocks");
- var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, blocksFolderPath);
+ var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
+ var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, workDir);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
Assert.Empty(wallet.Coins);
@@ -1472,8 +1472,8 @@ namespace WalletWasabi.Tests
var chaumianClient = new CcjClient(rpc.Network, coordinator.RsaKey.PubKey, keyManager, new Uri(RegTestFixture.BackendEndPoint));
// 6. Create wallet service.
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync), $"Blocks");
- var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, blocksFolderPath);
+ var workDir = Path.Combine(SharedFixture.DataDir, nameof(SendTestsFromHiddenWalletAsync));
+ var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, workDir);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
Assert.Empty(wallet.Coins);
@@ -2725,12 +2725,12 @@ namespace WalletWasabi.Tests
var chaumianClient2 = new CcjClient(network, coordinator.RsaKey.PubKey, keyManager2, new Uri(RegTestFixture.BackendEndPoint));
// 6. Create wallet service.
- var blocksFolderPath = Path.Combine(SharedFixture.DataDir, nameof(CoinJoinMultipleRoundTestsAsync), $"Blocks");
- var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, blocksFolderPath);
+ var workDir = Path.Combine(SharedFixture.DataDir, nameof(CoinJoinMultipleRoundTestsAsync));
+ var wallet = new WalletService(keyManager, indexDownloader, chaumianClient, memPoolService, nodes, workDir);
wallet.NewFilterProcessed += Wallet_NewFilterProcessed;
- var blocksFolderPath2 = Path.Combine(SharedFixture.DataDir, nameof(CoinJoinMultipleRoundTestsAsync), $"Blocks2");
- var wallet2 = new WalletService(keyManager2, indexDownloader2, chaumianClient2, memPoolService2, nodes2, blocksFolderPath2);
+ var workDir2 = Path.Combine(SharedFixture.DataDir, $"{nameof(CoinJoinMultipleRoundTestsAsync)}2");
+ var wallet2 = new WalletService(keyManager2, indexDownloader2, chaumianClient2, memPoolService2, nodes2, workDir2);
// Get some money, make it confirm.
var key = wallet.GetReceiveKey("fundZeroLink");

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -65,7 +65,7 @@ namespace WalletWasabi.Services
public bool IsRunning => Interlocked.Read(ref _running) == 1;
public bool IsStopping => Interlocked.Read(ref _running) == 2;
- public WalletService(KeyManager keyManager, IndexDownloader indexDownloader, CcjClient chaumianClient, MemPoolService memPool, NodesGroup nodes, string blocksFolderPath)
+ public WalletService(KeyManager keyManager, IndexDownloader indexDownloader, CcjClient chaumianClient, MemPoolService memPool, NodesGroup nodes, string workFolderDir)
{
KeyManager = Guard.NotNull(nameof(keyManager), keyManager);
Nodes = Guard.NotNull(nameof(nodes), nodes);
@@ -81,7 +81,7 @@ namespace WalletWasabi.Services
Coins = new NotifyingConcurrentHashSet<SmartCoin>();
TransactionCache = new ConcurrentHashSet<SmartTransaction>();
- BlocksFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(blocksFolderPath), blocksFolderPath, trim: true);
+ BlocksFolderPath = Path.Combine(workFolderDir, "Blocks", Network.ToString());
BlockFolderLock = new AsyncLock();
BlockDownloadLock = new AsyncLock();

WalletService should get work folder instead of BlocksFolder