Wallet file parsing: Add Wasabi test case and re-add Electrum distinction (#5694)

* Extend tests, add Wasabi file

* Re-add Electrum distinction

* Specter: Fix indentation

* Cleanups
This commit is contained in:
d11n
2024-01-24 01:28:22 +01:00
committed by GitHub
parent b03f8db06b
commit f31aa43c6a
8 changed files with 33 additions and 27 deletions

View File

@@ -96,7 +96,7 @@ namespace BTCPayServer
throw new ArgumentOutOfRangeException(nameof(outputDescriptor));
}
}
public DerivationStrategyBase Parse(string str, bool ignorePrefix = false, bool ignoreBasePrefix = false, bool enforceNetworkPrefix = true)
public DerivationStrategyBase Parse(string str, bool ignorePrefix = false, bool ignoreBasePrefix = false, bool enforceNetworkPrefix = true, bool electrum = true)
{
ArgumentNullException.ThrowIfNull(str);
str = str.Trim();
@@ -143,7 +143,7 @@ namespace BTCPayServer
throw new FormatException(
$"Invalid xpub. Is this really for {BtcPayNetwork.CryptoCode} {Network.ChainName}?");
if (!ignorePrefix && !hasLabel && BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
if (!ignorePrefix && !hasLabel && electrum && BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
{
switch (type)
{