Update tests related to Recover
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
@@ -75,8 +75,9 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
var result = KeyManager.Recover(
CurrentMnemonics!,
password!,
- walletFilePath,
+ Services.WalletManager.Network,
AccountKeyPath,
+ walletFilePath,
MinGapLimit);
result.SetNetwork(Services.WalletManager.Network);

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);
+ => KeyManager.CreateNew(out var _, password, null, Network.Main);
public static KeyManager CreateWatchOnlyKeyManager()
=> KeyManager.CreateNewWatchOnly(new Mnemonic(Wordlist.English, WordCount.Twelve).DeriveExtKey().Neuter());

MODIFY
WalletWasabi.Tests/UnitTests/KeyManagementTests.cs
WalletWasabi.Tests/UnitTests/KeyManagementTests.cs
@@ -68,14 +68,14 @@ namespace WalletWasabi.Tests.UnitTests
public void CanRecover()
{
string password = "password";
- var manager = KeyManager.CreateNew(out Mnemonic mnemonic, password);
- var sameManager = KeyManager.Recover(mnemonic, password);
+ var manager = KeyManager.CreateNew(out Mnemonic mnemonic, password, null, Network.Main);
+ var sameManager = KeyManager.Recover(mnemonic, password, Network.Main, KeyManager.GetAccountKeyPath(Network.Main), null);
Assert.Equal(manager.ChainCode, sameManager.ChainCode);
Assert.Equal(manager.EncryptedSecret, sameManager.EncryptedSecret);
Assert.Equal(manager.ExtPubKey, sameManager.ExtPubKey);
- var differentManager = KeyManager.Recover(mnemonic, "differentPassword", null, KeyPath.Parse("m/999'/999'/999'"), 55);
+ var differentManager = KeyManager.Recover(mnemonic, "differentPassword", Network.Main, KeyPath.Parse("m/999'/999'/999'"), null, 55);
Assert.NotEqual(manager.ChainCode, differentManager.ChainCode);
Assert.NotEqual(manager.EncryptedSecret, differentManager.EncryptedSecret);
Assert.NotEqual(manager.ExtPubKey, differentManager.ExtPubKey);

MODIFY
WalletWasabi/Blockchain/Keys/KeyManager.cs
WalletWasabi/Blockchain/Keys/KeyManager.cs
@@ -189,7 +189,7 @@ namespace WalletWasabi.Blockchain.Keys
return new KeyManager(null, null, masterFingerprint, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(network), filePath);
}
- public static KeyManager Recover(Mnemonic mnemonic, string password, string? filePath = null, KeyPath? accountKeyPath = null, int minGapLimit = AbsoluteMinGapLimit)
+ public static KeyManager Recover(Mnemonic mnemonic, string password, Network network, KeyPath accountKeyPath, string? filePath = null, int minGapLimit = AbsoluteMinGapLimit)
{
Guard.NotNull(nameof(mnemonic), mnemonic);
password ??= "";
@@ -201,7 +201,7 @@ namespace WalletWasabi.Blockchain.Keys
KeyPath keyPath = accountKeyPath ?? DefaultAccountKeyPath;
ExtPubKey extPubKey = extKey.Derive(keyPath).Neuter();
- return new KeyManager(encryptedSecret, extKey.ChainCode, masterFingerprint, extPubKey, true, minGapLimit, new BlockchainState(), filePath, keyPath);
+ return new KeyManager(encryptedSecret, extKey.ChainCode, masterFingerprint, extPubKey, true, minGapLimit, new BlockchainState(network), filePath, keyPath);
}
public static KeyManager FromFile(string filePath)

Update tests related to Recover