aboutsummaryrefslogtreecommitdiff
path: root/src/qt/paymentserver.cpp
diff options
context:
space:
mode:
authorjtimon <jtimon@monetize.io>2014-06-04 15:25:58 +0200
committerjtimon <jtimon@monetize.io>2014-06-04 15:33:11 +0200
commitf0a83fc256023f68cc046bd096de69f16ce9d394 (patch)
treec5c8b6d01282cbcee7c59d736e0640b798cd928c /src/qt/paymentserver.cpp
parent2871889e834b664bcaa3fdb3ecb6c5cdc751afb1 (diff)
Use Params().NetworkID() instead of TestNet() from the payment protocol
Diffstat (limited to 'src/qt/paymentserver.cpp')
-rw-r--r--src/qt/paymentserver.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 4c45585685..20551591c3 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -490,6 +490,17 @@ bool PaymentServer::readPaymentRequest(const QString& filename, PaymentRequestPl
return request.parse(data);
}
+std::string PaymentServer::mapNetworkIdToName(CChainParams::Network networkId)
+{
+ if (networkId == CChainParams::MAIN)
+ return "main";
+ if (networkId == CChainParams::TESTNET)
+ return "test";
+ if (networkId == CChainParams::REGTEST)
+ return "regtest";
+ return "";
+}
+
bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoinsRecipient& recipient)
{
if (!optionsModel)
@@ -499,8 +510,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
const payments::PaymentDetails& details = request.getDetails();
// Payment request network matches client network?
- if ((details.network() == "main" && TestNet()) ||
- (details.network() == "test" && !TestNet()))
+ if (details.network() != mapNetworkIdToName(Params().NetworkID()))
{
emit message(tr("Payment request rejected"), tr("Payment request network doesn't match client network."),
CClientUIInterface::MSG_ERROR);