conditionally select electrum mapping based on network

This commit is contained in:
Kukks
2019-05-09 09:20:51 +02:00
committed by Nicolas Dorier
parent bb3a087d39
commit a567c19759
2 changed files with 31 additions and 25 deletions

View File

@@ -27,18 +27,20 @@ namespace BTCPayServer
DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType),
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("0'") : new KeyPath("1'"),
SupportRBF = true,
ElectrumMapping = new Dictionary<uint, string[]>()
{
//https://github.com/spesmilo/electrum/blob/11733d6bc271646a00b69ff07657119598874da4/electrum/constants.py
//mainnet
{0x0488b21eU, new[] { "legacy" }},
{0x049d7cb2U, new[] { "p2sh" }},
{0x4b24746U, Array.Empty<string>()},
//testnet
{0x043587cfU, new[] { "legacy" }},
{0x044a5262U, new[] { "p2sh" }},
{0x045f1cf6U, Array.Empty<string>()}
}
//https://github.com/spesmilo/electrum/blob/11733d6bc271646a00b69ff07657119598874da4/electrum/constants.py
ElectrumMapping = NetworkType == NetworkType.Mainnet
? new Dictionary<uint, string[]>()
{
{0x0488b21eU, new[] {"legacy"}},
{0x049d7cb2U, new[] {"p2sh"}},
{0x4b24746U, Array.Empty<string>()},
}
: new Dictionary<uint, string[]>()
{
{0x043587cfU, new[] {"legacy"}},
{0x044a5262U, new[] {"p2sh"}},
{0x045f1cf6U, Array.Empty<string>()}
}
});
}
}

View File

@@ -17,7 +17,9 @@ namespace BTCPayServer
{
CryptoCode = nbxplorerNetwork.CryptoCode,
DisplayName = "Litecoin",
BlockExplorerLink = NetworkType == NetworkType.Mainnet ? "https://live.blockcypher.com/ltc/tx/{0}/" : "http://explorer.litecointools.com/tx/{0}",
BlockExplorerLink = NetworkType == NetworkType.Mainnet
? "https://live.blockcypher.com/ltc/tx/{0}/"
: "http://explorer.litecointools.com/tx/{0}",
NBitcoinNetwork = nbxplorerNetwork.NBitcoinNetwork,
NBXplorerNetwork = nbxplorerNetwork,
UriScheme = "litecoin",
@@ -25,18 +27,20 @@ namespace BTCPayServer
LightningImagePath = "imlegacy/litecoin-lightning.svg",
DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType),
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("2'") : new KeyPath("1'"),
ElectrumMapping = new Dictionary<uint, string[]>()
{
//https://github.com/pooler/electrum-ltc/blob/0d6989a9d2fb2edbea421c116e49d1015c7c5a91/electrum_ltc/constants.py
//mainnet
{0x0488b21eU, new[] { "legacy" }},
{0x049d7cb2U, new[] { "p2sh" }},
{0x04b24746U, Array.Empty<string>()},
//testnet
{0x043587cfU, new[] { "legacy" }},
{0x044a5262U, new[] { "p2sh" }},
{0x045f1cf6U, Array.Empty<string>()}
}
//https://github.com/pooler/electrum-ltc/blob/0d6989a9d2fb2edbea421c116e49d1015c7c5a91/electrum_ltc/constants.py
ElectrumMapping = NetworkType == NetworkType.Mainnet
? new Dictionary<uint, string[]>()
{
{0x0488b21eU, new[] {"legacy"}},
{0x049d7cb2U, new[] {"p2sh"}},
{0x04b24746U, Array.Empty<string>()},
}
: new Dictionary<uint, string[]>()
{
{0x043587cfU, new[] {"legacy"}},
{0x044a5262U, new[] {"p2sh"}},
{0x045f1cf6U, Array.Empty<string>()}
}
});
}
}