mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
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
This commit is contained in:
parent
8230a408ac
commit
2042f59283
@ -18,8 +18,6 @@ namespace BTCPayServer
|
|||||||
|
|
||||||
public Script HintScriptPubKey { get; set; }
|
public Script HintScriptPubKey { get; set; }
|
||||||
|
|
||||||
Dictionary<uint, string[]> ElectrumMapping = new Dictionary<uint, string[]>();
|
|
||||||
|
|
||||||
public DerivationSchemeParser(BTCPayNetwork expectedNetwork)
|
public DerivationSchemeParser(BTCPayNetwork expectedNetwork)
|
||||||
{
|
{
|
||||||
if (expectedNetwork == null)
|
if (expectedNetwork == null)
|
||||||
@ -42,7 +40,7 @@ namespace BTCPayServer
|
|||||||
var standardPrefix = Utils.ToBytes(0x0488b21eU, false);
|
var standardPrefix = Utils.ToBytes(0x0488b21eU, false);
|
||||||
for (int ii = 0; ii < 4; ii++)
|
for (int ii = 0; ii < 4; ii++)
|
||||||
data[ii] = standardPrefix[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))
|
if (!BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
|
||||||
{
|
{
|
||||||
throw new FormatException();
|
throw new FormatException();
|
||||||
@ -119,7 +117,7 @@ namespace BTCPayServer
|
|||||||
var standardPrefix = Utils.ToBytes(0x0488b21eU, false);
|
var standardPrefix = Utils.ToBytes(0x0488b21eU, false);
|
||||||
for (int ii = 0; ii < 4; ii++)
|
for (int ii = 0; ii < 4; ii++)
|
||||||
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.NetworkSet.Mainnet).ToNetwork(Network).ToString();
|
||||||
|
|
||||||
if (BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
|
if (BtcPayNetwork.ElectrumMapping.TryGetValue(prefix, out var type))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user