diff options
author | unknown <prayank23@outlook.com> | 2021-04-14 01:21:49 +0530 |
---|---|---|
committer | unknown <prayank23@outlook.com> | 2021-05-02 07:47:19 +0530 |
commit | 3bad0b3fada9ab7c5b03d31dc33d72654c1ba2be (patch) | |
tree | c916aca407ddebadf4b07e8c9356df73e1d17511 /src | |
parent | a1f0b8b62eb851c837a3618583b7c2fd4d12006c (diff) | |
download | bitcoin-3bad0b3fada9ab7c5b03d31dc33d72654c1ba2be.tar.xz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/paymentserver.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 58f6c14e7a..d58d13f722 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 |