Skip to content

Commit

Permalink
Remove user input from URI error message
Browse files Browse the repository at this point in the history
+ Detailed error messages for invalid address
+ Used `IsValidDestination` instead of `IsValidDestinationString`
+ Referred to bitcoin#20832 for solution

Github-Pull: bitcoin-core/gui#280
Rebased-From: 3bad0b3
  • Loading branch information
unknown authored and MarcoFalke committed May 22, 2021
1 parent f2a8898 commit c0b2ff7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qt/paymentserver.cpp
Expand Up @@ -233,15 +233,18 @@ 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.")+
tr("Due to widespread security flaws in BIP70 it's strongly recommended that any merchant instructions to switch wallets be ignored.")+
tr("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
Expand Down

0 comments on commit c0b2ff7

Please sign in to comment.