mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 21:32:27 +01:00
Fix tests
This commit is contained in:
parent
bbeb2d5009
commit
602625fc17
@ -1467,9 +1467,11 @@ namespace BTCPayServer.Tests
|
|||||||
var mainnetParser = new DerivationSchemeParser(mainnetNetworkProvider.GetNetwork("BTC"));
|
var mainnetParser = new DerivationSchemeParser(mainnetNetworkProvider.GetNetwork("BTC"));
|
||||||
NBXplorer.DerivationStrategy.DerivationStrategyBase result;
|
NBXplorer.DerivationStrategy.DerivationStrategyBase result;
|
||||||
// Passing electrum stuff
|
// Passing electrum stuff
|
||||||
// Native
|
// Passing a native segwit from mainnet to a testnet parser, means the testnet parser will try to convert it into segwit
|
||||||
result = testnetParser.Parse("zpub6nL6PUGurpU3DfPDSZaRS6WshpbNc9ctCFFzrCn54cssnheM31SZJZUcFHKtjJJNhAueMbh6ptFMfy1aeiMQJr3RJ4DDt1hAPx7sMTKV48t");
|
result = testnetParser.Parse("zpub6nL6PUGurpU3DfPDSZaRS6WshpbNc9ctCFFzrCn54cssnheM31SZJZUcFHKtjJJNhAueMbh6ptFMfy1aeiMQJr3RJ4DDt1hAPx7sMTKV48t");
|
||||||
Assert.Equal("tpubD93CJNkmGjLXnsBqE2zGDqfEh1Q8iJ8wueordy3SeWt1RngbbuxXCsqASuVWFywmfoCwUE1rSfNJbaH4cBNcbp8WcyZgPiiRSTazLGL8U9w", result.ToString());
|
Assert.Equal("tpubD93CJNkmGjLXnsBqE2zGDqfEh1Q8iJ8wueordy3SeWt1RngbbuxXCsqASuVWFywmfoCwUE1rSfNJbaH4cBNcbp8WcyZgPiiRSTazLGL8U9w", result.ToString());
|
||||||
|
result = mainnetParser.Parse("zpub6nL6PUGurpU3DfPDSZaRS6WshpbNc9ctCFFzrCn54cssnheM31SZJZUcFHKtjJJNhAueMbh6ptFMfy1aeiMQJr3RJ4DDt1hAPx7sMTKV48t");
|
||||||
|
Assert.Equal("xpub68fZn8w5ZTP5X4zymr1B1vKsMtJUiudtN2DZHQzJJc87gW1tXh7S4SALCsQijUzXstg2reVyuZYFuPnTDKXNiNgDZNpNiC4BrVzaaGEaRHj", result.ToString());
|
||||||
// P2SH
|
// P2SH
|
||||||
result = testnetParser.Parse("upub57Wa4MvRPNyAipy1MCpERxcFpHR2ZatyikppkyeWkoRL6QJvLVMo39jYdcaJVxyvBURyRVmErBEA5oGicKBgk1j72GAXSPFH5tUDoGZ8nEu");
|
result = testnetParser.Parse("upub57Wa4MvRPNyAipy1MCpERxcFpHR2ZatyikppkyeWkoRL6QJvLVMo39jYdcaJVxyvBURyRVmErBEA5oGicKBgk1j72GAXSPFH5tUDoGZ8nEu");
|
||||||
Assert.Equal("tpubD6NzVbkrYhZ4YWjDJUACG9E8fJx2NqNY1iynTiPKEjJrzzRKAgha3nNnwGXr2BtvCJKJHW4nmG7rRqc2AGGy2AECgt16seMyV2FZivUmaJg-[p2sh]", result.ToString());
|
Assert.Equal("tpubD6NzVbkrYhZ4YWjDJUACG9E8fJx2NqNY1iynTiPKEjJrzzRKAgha3nNnwGXr2BtvCJKJHW4nmG7rRqc2AGGy2AECgt16seMyV2FZivUmaJg-[p2sh]", result.ToString());
|
||||||
|
@ -118,22 +118,16 @@ namespace BTCPayServer
|
|||||||
data[ii] = standardPrefix[ii];
|
data[ii] = standardPrefix[ii];
|
||||||
var derivationScheme = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.Main).ToNetwork(Network).ToString();
|
var derivationScheme = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.Main).ToNetwork(Network).ToString();
|
||||||
|
|
||||||
BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type);
|
if (BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
|
||||||
List<string> labels = new List<string>();
|
|
||||||
switch (type)
|
|
||||||
{
|
{
|
||||||
case DerivationType.Legacy:
|
switch (type)
|
||||||
labels.Add("legacy");
|
|
||||||
break;
|
|
||||||
case DerivationType.SegwitP2SH:
|
|
||||||
labels.Add("p2sh");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (labels != null)
|
|
||||||
{
|
|
||||||
foreach (var label in labels)
|
|
||||||
{
|
{
|
||||||
hintedLabels.Add(label.ToLowerInvariant());
|
case DerivationType.Legacy:
|
||||||
|
hintedLabels.Add("legacy");
|
||||||
|
break;
|
||||||
|
case DerivationType.SegwitP2SH:
|
||||||
|
hintedLabels.Add("p2sh");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parts[i] = derivationScheme;
|
parts[i] = derivationScheme;
|
||||||
|
Loading…
Reference in New Issue
Block a user