Skip to content

Commit

Permalink
Detailed error messages for invalid address
Browse files Browse the repository at this point in the history
+ Used `IsValidDestination` instead of `IsValidDestinationString`
+ Referred to bitcoin/bitcoin#20832 for solution
  • Loading branch information
unknown committed Apr 16, 2021
1 parent d6bdd6d commit 9885de1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qt/paymentserver.cpp
Expand Up @@ -232,15 +232,18 @@ void PaymentServer::handleURIOrFile(const QString& s)
SendCoinsRecipient recipient;
if (GUIUtil::parseBitcoinURI(s, &recipient))
{
if (!IsValidDestinationString(recipient.address.toStdString())) {
std::string error_msg;
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"
"Due to widespread security flaws in BIP70 it's strongly recommended that any merchant instructions to switch wallets be ignored.\n"
"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"),
Q_EMIT message(tr("URI handling"), tr(error_msg.c_str()),
CClientUIInterface::MSG_ERROR);
}
else
Expand Down

0 comments on commit 9885de1

Please sign in to comment.