Skip to content

Commit c0b2ff7

Browse files
unknownMarcoFalke
unknown
authored and
MarcoFalke
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 Github-Pull: bitcoin-core/gui#280 Rebased-From: 3bad0b3
1 parent f2a8898 commit c0b2ff7

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
@@ -233,15 +233,18 @@ void PaymentServer::handleURIOrFile(const QString& s)
233233
SendCoinsRecipient recipient;
234234
if (GUIUtil::parseBitcoinURI(s, &recipient))
235235
{
236-
if (!IsValidDestinationString(recipient.address.toStdString())) {
236+
std::string error_msg;
237+
const CTxDestination dest = DecodeDestination(recipient.address.toStdString(), error_msg);
238+
239+
if (!IsValidDestination(dest)) {
237240
if (uri.hasQueryItem("r")) { // payment request
238241
Q_EMIT message(tr("URI handling"),
239242
tr("Cannot process payment request because BIP70 is not supported.")+
240243
tr("Due to widespread security flaws in BIP70 it's strongly recommended that any merchant instructions to switch wallets be ignored.")+
241244
tr("If you are receiving this error you should request the merchant provide a BIP21 compatible URI."),
242245
CClientUIInterface::ICON_WARNING);
243246
}
244-
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
247+
Q_EMIT message(tr("URI handling"), QString::fromStdString(error_msg),
245248
CClientUIInterface::MSG_ERROR);
246249
}
247250
else

0 commit comments

Comments
 (0)