diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -129,7 +129,7 @@ private: static bool readPaymentRequestFromFile(const QString &filename, PaymentRequestPlus &request); - bool handleURI(const QString &scheme, const QString &s); + bool handleURI(const CChainParams ¶ms, const QString &s); bool processPaymentRequest(const PaymentRequestPlus &request, SendCoinsRecipient &recipient); void fetchRequest(const QUrl &url); diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -427,7 +426,8 @@ savedPaymentRequests.clear(); } -bool PaymentServer::handleURI(const QString &scheme, const QString &s) { +bool PaymentServer::handleURI(const CChainParams ¶ms, const QString &s) { + const QString scheme = QString::fromStdString(params.CashAddrPrefix()); if (!s.startsWith(scheme + ":", Qt::CaseInsensitive)) { return false; } @@ -460,7 +460,7 @@ SendCoinsRecipient recipient; if (GUIUtil::parseBitcoinURI(scheme, s, &recipient)) { if (!IsValidDestinationString(recipient.address.toStdString(), - GetConfig().GetChainParams())) { + params)) { Q_EMIT message( tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address), @@ -486,14 +486,7 @@ } // bitcoincash: CashAddr URI - QString schemeCash = GUIUtil::bitcoinURIScheme(Params(), true); - if (handleURI(schemeCash, s)) { - return; - } - - // bitcoincash: Legacy URI - QString schemeLegacy = GUIUtil::bitcoinURIScheme(Params(), false); - if (handleURI(schemeLegacy, s)) { + if (handleURI(Params(), s)) { return; }