BitcoinStore: Do not create dependencies in the constructor, pass everything via constructor
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -20,10 +20,13 @@ using WalletWasabi.BitcoinCore;
using WalletWasabi.BitcoinCore.Endpointing;
using WalletWasabi.BitcoinCore.Monitoring;
using WalletWasabi.Blockchain.Analysis.FeesEstimation;
+using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Blockchain.Keys;
+using WalletWasabi.Blockchain.Mempool;
using WalletWasabi.Blockchain.TransactionBroadcasting;
using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Blockchain.TransactionProcessing;
+using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.CoinJoin.Client;
using WalletWasabi.CoinJoin.Client.Clients;
using WalletWasabi.CoinJoin.Client.Clients.Queuing;
@@ -102,7 +105,13 @@ namespace WalletWasabi.Gui
WalletManager.OnDequeue += WalletManager_OnDequeue;
WalletManager.WalletRelevantTransactionProcessed += WalletManager_WalletRelevantTransactionProcessed;
- BitcoinStore = new BitcoinStore(Path.Combine(DataDir, "BitcoinStore"), Network);
+ BitcoinStore = new BitcoinStore(
+ Path.Combine(DataDir, "BitcoinStore"), Network,
+ new IndexStore(),
+ new AllTransactionStore(),
+ new SmartHeaderChain(),
+ new MempoolService()
+ );
}
}

MODIFY
WalletWasabi/Stores/BitcoinStore.cs
WalletWasabi/Stores/BitcoinStore.cs
@@ -34,17 +34,22 @@ namespace WalletWasabi.Stores
/// </summary>
public UntrustedP2pBehavior CreateUntrustedP2pBehavior() => new UntrustedP2pBehavior(MempoolService);
- public BitcoinStore(string workFolderPath, Network network)
+ public BitcoinStore(
+ string workFolderPath,
+ Network network,
+ IndexStore indexStore,
+ AllTransactionStore transactionStore,
+ SmartHeaderChain smartHeaderChain,
+ MempoolService mempoolService)
{
WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
IoHelpers.EnsureDirectoryExists(WorkFolderPath);
Network = Guard.NotNull(nameof(network), network);
-
- IndexStore = new IndexStore();
- TransactionStore = new AllTransactionStore();
- SmartHeaderChain = new SmartHeaderChain();
- MempoolService = new MempoolService();
+ IndexStore = indexStore;
+ TransactionStore = transactionStore;
+ SmartHeaderChain = smartHeaderChain;
+ MempoolService = mempoolService;
}
public async Task InitializeAsync()

BitcoinStore: Do not create dependencies in the constructor, pass everything via constructor