From a567c19759b9f1a4cd47acb7ddd2d53f0eb6c84d Mon Sep 17 00:00:00 2001 From: Kukks Date: Thu, 9 May 2019 09:20:51 +0200 Subject: [PATCH] conditionally select electrum mapping based on network --- BTCPayServer/BTCPayNetworkProvider.Bitcoin.cs | 26 ++++++++-------- .../BTCPayNetworkProvider.Litecoin.cs | 30 +++++++++++-------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/BTCPayServer/BTCPayNetworkProvider.Bitcoin.cs b/BTCPayServer/BTCPayNetworkProvider.Bitcoin.cs index 389bb0ca0..430b6e3d4 100644 --- a/BTCPayServer/BTCPayNetworkProvider.Bitcoin.cs +++ b/BTCPayServer/BTCPayNetworkProvider.Bitcoin.cs @@ -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() - { - //https://github.com/spesmilo/electrum/blob/11733d6bc271646a00b69ff07657119598874da4/electrum/constants.py - //mainnet - {0x0488b21eU, new[] { "legacy" }}, - {0x049d7cb2U, new[] { "p2sh" }}, - {0x4b24746U, Array.Empty()}, - //testnet - {0x043587cfU, new[] { "legacy" }}, - {0x044a5262U, new[] { "p2sh" }}, - {0x045f1cf6U, Array.Empty()} - } + //https://github.com/spesmilo/electrum/blob/11733d6bc271646a00b69ff07657119598874da4/electrum/constants.py + ElectrumMapping = NetworkType == NetworkType.Mainnet + ? new Dictionary() + { + {0x0488b21eU, new[] {"legacy"}}, + {0x049d7cb2U, new[] {"p2sh"}}, + {0x4b24746U, Array.Empty()}, + } + : new Dictionary() + { + {0x043587cfU, new[] {"legacy"}}, + {0x044a5262U, new[] {"p2sh"}}, + {0x045f1cf6U, Array.Empty()} + } }); } } diff --git a/BTCPayServer/BTCPayNetworkProvider.Litecoin.cs b/BTCPayServer/BTCPayNetworkProvider.Litecoin.cs index c75b123fa..c8e01b90d 100644 --- a/BTCPayServer/BTCPayNetworkProvider.Litecoin.cs +++ b/BTCPayServer/BTCPayNetworkProvider.Litecoin.cs @@ -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() - { - //https://github.com/pooler/electrum-ltc/blob/0d6989a9d2fb2edbea421c116e49d1015c7c5a91/electrum_ltc/constants.py - //mainnet - {0x0488b21eU, new[] { "legacy" }}, - {0x049d7cb2U, new[] { "p2sh" }}, - {0x04b24746U, Array.Empty()}, - //testnet - {0x043587cfU, new[] { "legacy" }}, - {0x044a5262U, new[] { "p2sh" }}, - {0x045f1cf6U, Array.Empty()} - } + //https://github.com/pooler/electrum-ltc/blob/0d6989a9d2fb2edbea421c116e49d1015c7c5a91/electrum_ltc/constants.py + ElectrumMapping = NetworkType == NetworkType.Mainnet + ? new Dictionary() + { + {0x0488b21eU, new[] {"legacy"}}, + {0x049d7cb2U, new[] {"p2sh"}}, + {0x04b24746U, Array.Empty()}, + } + : new Dictionary() + { + {0x043587cfU, new[] {"legacy"}}, + {0x044a5262U, new[] {"p2sh"}}, + {0x045f1cf6U, Array.Empty()} + } }); } }