Skip to content

Commit 9885de1

Browse files
author
unknown
committed
Detailed error messages for invalid address
+ Used `IsValidDestination` instead of `IsValidDestinationString` + Referred to bitcoin/bitcoin#20832 for solution
1 parent d6bdd6d commit 9885de1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/qt/paymentserver.cpp

Lines changed: 5 additions & 2 deletions
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+
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"),
246+
Q_EMIT message(tr("URI handling"), tr(error_msg.c_str()),
244247
CClientUIInterface::MSG_ERROR);
245248
}
246249
else

0 commit comments

Comments
 (0)