mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
Remove user input from URI error message
+ Detailed error messages for invalid address + Used `IsValidDestination` instead of `IsValidDestinationString` + Referred to https://github.com/bitcoin/bitcoin/pull/20832 for solution
This commit is contained in:
parent
a1f0b8b62e
commit
3bad0b3fad
1 changed files with 5 additions and 2 deletions
|
@ -232,7 +232,10 @@ void PaymentServer::handleURIOrFile(const QString& s)
|
||||||
SendCoinsRecipient recipient;
|
SendCoinsRecipient recipient;
|
||||||
if (GUIUtil::parseBitcoinURI(s, &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
|
if (uri.hasQueryItem("r")) { // payment request
|
||||||
Q_EMIT message(tr("URI handling"),
|
Q_EMIT message(tr("URI handling"),
|
||||||
tr("Cannot process payment request because BIP70 is not supported.\n"
|
tr("Cannot process payment request because BIP70 is not supported.\n"
|
||||||
|
@ -240,7 +243,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
|
||||||
"If you are receiving this error you should request the merchant provide a BIP21 compatible URI."),
|
"If you are receiving this error you should request the merchant provide a BIP21 compatible URI."),
|
||||||
CClientUIInterface::ICON_WARNING);
|
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);
|
CClientUIInterface::MSG_ERROR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue