Use NBitcoin.KeyPath.TryParse
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
@@ -63,13 +63,8 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
ValidationMessage = $"Min Gap Limit cannot be larger than {1_000_000}.";
}
- else if (!TryParseKeyPath(AccountKeyPath))
+ else if (KeyPath.TryParse(AccountKeyPath, out KeyPath keyPath))
{
- ValidationMessage = "The account key path is not a valid derivation path.";
- }
- else
- {
- KeyPath keyPath = KeyPath.Parse(AccountKeyPath);
try
{
var mnemonic = new Mnemonic(MnemonicWords);
@@ -83,6 +78,10 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
Logger.LogError<LoadWalletViewModel>(ex);
}
}
+ else
+ {
+ ValidationMessage = "The account key path is not a valid derivation path.";
+ }
});
this.WhenAnyValue(x => x.MnemonicWords).Subscribe(x => UpdateSuggestions(x));
@@ -244,19 +243,6 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
Suggestions.Clear();
}
- private bool TryParseKeyPath(string keyPath)
- {
- try
- {
- KeyPath.Parse(keyPath);
- return true;
- }
- catch (FormatException)
- {
- return false;
- }
- }
-
private static IEnumerable<string> EnglishWords { get; } = Wordlist.English.GetWords();
}
}

Use NBitcoin.KeyPath.TryParse