From 2042f592834822d392a960d57dbadd39fe91b248 Mon Sep 17 00:00:00 2001 From: Kukks Date: Wed, 24 Jun 2020 10:18:45 +0200 Subject: [PATCH] fix ypub/zpub parsing for all alts @gruve-p reported that ypub import was not working and then found this. no ypub/zpub import for any alts worked before lol --- BTCPayServer/DerivationSchemeParser.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/BTCPayServer/DerivationSchemeParser.cs b/BTCPayServer/DerivationSchemeParser.cs index 16797513b..bca4d570d 100644 --- a/BTCPayServer/DerivationSchemeParser.cs +++ b/BTCPayServer/DerivationSchemeParser.cs @@ -17,8 +17,6 @@ namespace BTCPayServer public Network Network => BtcPayNetwork.NBitcoinNetwork; public Script HintScriptPubKey { get; set; } - - Dictionary ElectrumMapping = new Dictionary(); public DerivationSchemeParser(BTCPayNetwork expectedNetwork) { @@ -42,7 +40,7 @@ namespace BTCPayServer var standardPrefix = Utils.ToBytes(0x0488b21eU, false); for (int ii = 0; ii < 4; ii++) data[ii] = standardPrefix[ii]; - var extPubKey = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.Main).ToNetwork(Network); + var extPubKey = new BitcoinExtPubKey(Network.GetBase58CheckEncoder().EncodeData(data), Network.NetworkSet.Mainnet).ToNetwork(Network); if (!BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type)) { throw new FormatException(); @@ -119,7 +117,7 @@ namespace BTCPayServer var standardPrefix = Utils.ToBytes(0x0488b21eU, false); for (int ii = 0; ii < 4; 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.NetworkSet.Mainnet).ToNetwork(Network).ToString(); if (BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type)) {