From 3bad0b3fada9ab7c5b03d31dc33d72654c1ba2be Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Apr 2021 01:21:49 +0530 Subject: [PATCH] Remove user input from URI error message + Detailed error messages for invalid address + Used `IsValidDestination` instead of `IsValidDestinationString` + Referred to https://github.com/bitcoin/bitcoin/pull/20832 for solution --- src/qt/paymentserver.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 58f6c14e7a1..d58d13f7229 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -232,7 +232,10 @@ void PaymentServer::handleURIOrFile(const QString& s) SendCoinsRecipient recipient; if (GUIUtil::parseBitcoinURI(s, &recipient)) { - if (!IsValidDestinationString(recipient.address.toStdString())) { + std::string error_msg; + const CTxDestination dest = DecodeDestination(recipient.address.toStdString(), error_msg); + + if (!IsValidDestination(dest)) { if (uri.hasQueryItem("r")) { // payment request Q_EMIT message(tr("URI handling"), tr("Cannot process payment request because BIP70 is not supported.\n" @@ -240,7 +243,7 @@ void PaymentServer::handleURIOrFile(const QString& s) "If you are receiving this error you should request the merchant provide a BIP21 compatible URI."), CClientUIInterface::ICON_WARNING); } - Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address), + Q_EMIT message(tr("URI handling"), QString::fromStdString(error_msg), CClientUIInterface::MSG_ERROR); } else