Skip to content

Commit 3bad0b3

Browse files
author
unknown
committed
Remove user input from URI error message
+ Detailed error messages for invalid address + Used `IsValidDestination` instead of `IsValidDestinationString` + Referred to bitcoin#20832 for solution
1 parent a1f0b8b commit 3bad0b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/qt/paymentserver.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,18 @@ void PaymentServer::handleURIOrFile(const QString& s)
232232
SendCoinsRecipient recipient;
233233
if (GUIUtil::parseBitcoinURI(s, &recipient))
234234
{
235-
if (!IsValidDestinationString(recipient.address.toStdString())) {
235+
std::string error_msg;
236+
const CTxDestination dest = DecodeDestination(recipient.address.toStdString(), error_msg);
237+
238+
if (!IsValidDestination(dest)) {
236239
if (uri.hasQueryItem("r")) { // payment request
237240
Q_EMIT message(tr("URI handling"),
238241
tr("Cannot process payment request because BIP70 is not supported.\n"
239242
"Due to widespread security flaws in BIP70 it's strongly recommended that any merchant instructions to switch wallets be ignored.\n"
240243
"If you are receiving this error you should request the merchant provide a BIP21 compatible URI."),
241244
CClientUIInterface::ICON_WARNING);
242245
}
243-
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
246+
Q_EMIT message(tr("URI handling"), QString::fromStdString(error_msg),
244247
CClientUIInterface::MSG_ERROR);
245248
}
246249
else

0 commit comments

Comments
 (0)