Update tests related to CreateNew
MODIFY
WalletWasabi.Tests/Helpers/ServiceFactory.cs
WalletWasabi.Tests/Helpers/ServiceFactory.cs
@@ -46,7 +46,7 @@ namespace WalletWasabi.Tests.Helpers
}
public static KeyManager CreateKeyManager(string password = "blahblahblah")
- => KeyManager.CreateNew(out var _, password, null, Network.Main);
+ => KeyManager.CreateNew(out var _, password, Network.Main);
public static KeyManager CreateWatchOnlyKeyManager()
=> KeyManager.CreateNewWatchOnly(new Mnemonic(Wordlist.English, WordCount.Twelve).DeriveExtKey().Neuter());

MODIFY
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
WalletWasabi.Tests/IntegrationTests/P2pTests.cs
@@ -94,7 +94,7 @@ namespace WalletWasabi.Tests.IntegrationTests
using var nodes = new NodesGroup(network, connectionParameters, requirements: Constants.NodeRequirements);
- KeyManager keyManager = KeyManager.CreateNew(out _, "password");
+ KeyManager keyManager = KeyManager.CreateNew(out _, "password", network);
using HttpClientFactory httpClientFactory = new(Common.TorSocks5Endpoint, backendUriGetter: () => new Uri("http://localhost:12345"));
WasabiSynchronizer synchronizer = new(bitcoinStore, httpClientFactory);
var feeProvider = new HybridFeeProvider(synchronizer, null);

MODIFY
WalletWasabi.Tests/RegressionTests/BuildTests.cs
WalletWasabi.Tests/RegressionTests/BuildTests.cs
@@ -59,7 +59,7 @@ namespace WalletWasabi.Tests.RegressionTests
HybridFeeProvider feeProvider = new(synchronizer, null);
// 4. Create key manager service.
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();
@@ -212,7 +212,7 @@ namespace WalletWasabi.Tests.RegressionTests
HybridFeeProvider feeProvider = new(synchronizer, null);
// 4. Create key manager service.
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();

MODIFY
WalletWasabi.Tests/RegressionTests/SendTests.cs
WalletWasabi.Tests/RegressionTests/SendTests.cs
@@ -56,7 +56,7 @@ namespace WalletWasabi.Tests.RegressionTests
HybridFeeProvider feeProvider = new(synchronizer, null);
// 4. Create key manager service.
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();
@@ -534,7 +534,7 @@ namespace WalletWasabi.Tests.RegressionTests
HybridFeeProvider feeProvider = new(synchronizer, null);
// 4. Create key manager service.
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();
@@ -708,7 +708,7 @@ namespace WalletWasabi.Tests.RegressionTests
HybridFeeProvider feeProvider = new(synchronizer, null);
// 4. Create key manager service.
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// 5. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();

MODIFY
WalletWasabi.Tests/RegressionTests/WalletTests.cs
WalletWasabi.Tests/RegressionTests/WalletTests.cs
@@ -120,7 +120,7 @@ namespace WalletWasabi.Tests.RegressionTests
{
(string password, IRPCClient rpc, Network network, _, _, BitcoinStore bitcoinStore, Backend.Global global) = await Common.InitializeTestEnvironmentAsync(RegTestFixture, 1);
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// Mine some coins, make a few bech32 transactions then make it confirm.
await rpc.GenerateAsync(1);
@@ -243,7 +243,7 @@ namespace WalletWasabi.Tests.RegressionTests
HybridFeeProvider feeProvider = new(synchronizer, null);
// 3. Create key manager service.
- var keyManager = KeyManager.CreateNew(out _, password);
+ var keyManager = KeyManager.CreateNew(out _, password, network);
// 4. Create wallet service.
var workDir = Helpers.Common.GetWorkDir();

MODIFY
WalletWasabi.Tests/UnitTests/SmartCoinTests.cs
WalletWasabi.Tests/UnitTests/SmartCoinTests.cs
@@ -16,7 +16,7 @@ namespace WalletWasabi.Tests.UnitTests
{
var tx = Transaction.Parse("0100000000010176f521a178a4b394b647169a89b29bb0d95b6bce192fd686d533eb4ea98464a20000000000ffffffff02ed212d020000000016001442da650f25abde0fef57badd745df7346e3e7d46fbda6400000000001976a914bd2e4029ce7d6eca7d2c3779e8eac36c952afee488ac02483045022100ea43ccf95e1ac4e8b305c53761da7139dbf6ff164e137a6ce9c09e15f316c22902203957818bc505bbafc181052943d7ab1f3ae82c094bf749813e8f59108c6c268a012102e59e61f20c7789aa73faf5a92dc8c0424e538c635c55d64326d95059f0f8284200000000", Network.TestNet);
var index = 0U;
- var km = KeyManager.CreateNew(out _, "");
+ var km = KeyManager.CreateNew(out _, "", Network.Main);
var hdpk1 = km.GenerateNewKey(SmartLabel.Empty, KeyState.Clean, false);
var hdpk2 = km.GenerateNewKey(SmartLabel.Empty, KeyState.Clean, false);
tx.Outputs[0].ScriptPubKey = hdpk1.P2wpkhScript;

MODIFY
WalletWasabi.Tests/UnitTests/Transactions/TransactionProcessorTests.cs
WalletWasabi.Tests/UnitTests/Transactions/TransactionProcessorTests.cs
@@ -1373,7 +1373,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
private TransactionProcessor CreateTransactionProcessor(AllTransactionStore transactionStore, int privacyLevelThreshold = 100)
{
- var keyManager = KeyManager.CreateNew(out _, "password");
+ var keyManager = KeyManager.CreateNew(out _, "password", Network.Main);
keyManager.AssertCleanKeysIndexed();
return new TransactionProcessor(

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/Participant.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/Participant.cs
@@ -24,7 +24,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
Rpc = rpc;
HttpClientFactory = httpClientFactory;
- KeyManager = KeyManager.CreateNew(out var _, password: "");
+ KeyManager = KeyManager.CreateNew(out var _, password: "", Network.Main);
KeyManager.AssertCleanKeysIndexed();
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
@@ -72,7 +72,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
cts.Token.Register(() => transactionCompleted.TrySetCanceled(), useSynchronizationContext: false);
// Create a key manager and use it to create fake coins.
- var keyManager = KeyManager.CreateNew(out var _, password: "");
+ var keyManager = KeyManager.CreateNew(out var _, password: "", Network.Main);
keyManager.AssertCleanKeysIndexed();
var coins = keyManager.GetKeys()
.Take(inputCount)
@@ -116,7 +116,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
});
}).CreateClient();
-
// Create the coinjoin client
var apiClient = _apiApplicationFactory.CreateWabiSabiHttpApiClient(httpClient);
var mockHttpClientFactory = new Mock<IBackendHttpClientFactory>();
@@ -156,10 +155,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
cts.Token.Register(() => transactionCompleted.TrySetCanceled(), useSynchronizationContext: false);
- var keyManager1 = KeyManager.CreateNew(out var _, password: "");
+ var keyManager1 = KeyManager.CreateNew(out var _, password: "", Network.Main);
keyManager1.AssertCleanKeysIndexed();
- var keyManager2 = KeyManager.CreateNew(out var _, password: "");
+ var keyManager2 = KeyManager.CreateNew(out var _, password: "", Network.Main);
keyManager2.AssertCleanKeysIndexed();
var coins = keyManager1.GetKeys()

MODIFY
WalletWasabi/Blockchain/Keys/KeyManager.cs
WalletWasabi/Blockchain/Keys/KeyManager.cs
@@ -164,7 +164,7 @@ namespace WalletWasabi.Blockchain.Keys
private object ToFileLock { get; }
public string WalletName => string.IsNullOrWhiteSpace(FilePath) ? "" : Path.GetFileNameWithoutExtension(FilePath);
- public static KeyManager CreateNew(out Mnemonic mnemonic, string password, string? filePath = null, Network? network = null)
+ public static KeyManager CreateNew(out Mnemonic mnemonic, string password, Network? network = null, string? filePath = null)
{
password ??= "";

MODIFY
WalletWasabi/Blockchain/Keys/WalletGenerator.cs
WalletWasabi/Blockchain/Keys/WalletGenerator.cs
@@ -42,7 +42,7 @@ namespace WalletWasabi.Blockchain.Keys
// Here we are not letting anything that will be autocorrected later. We need to generate the wallet exactly with the entered password because of compatibility.
PasswordHelper.Guard(password);
- var km = KeyManager.CreateNew(out Mnemonic mnemonic, password, null, Network);
+ var km = KeyManager.CreateNew(out Mnemonic mnemonic, password, Network, null);
km.SetNetwork(Network);
km.SetBestHeight(new Height(TipHeight));
km.SetFilePath(walletFilePath);

Update tests related to CreateNew