[Qt] ensure payment request network matches client network
- replaces checks in SendCoinsDialog::handlePaymentRequest() that belong to PaymentServer (normal URIs are special cased, as only an isValid check is done on BTC addresses) - prevents the client to handle payment requests that do not match the clients network and shows an error instead (mainly a problem with drag&drop payment requests onto the client window) - includes some small comment changes also
This commit is contained in:
@@ -377,26 +377,8 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
|
||||
|
||||
bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
|
||||
{
|
||||
QString strSendCoins = tr("Send Coins");
|
||||
if (rv.paymentRequest.IsInitialized()) {
|
||||
// Expired payment request?
|
||||
const payments::PaymentDetails& details = rv.paymentRequest.getDetails();
|
||||
if (details.has_expires() && (int64_t)details.expires() < GetTime())
|
||||
{
|
||||
emit message(strSendCoins, tr("Payment request expired"),
|
||||
CClientUIInterface::MSG_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
CBitcoinAddress address(rv.address.toStdString());
|
||||
if (!address.IsValid()) {
|
||||
emit message(strSendCoins, tr("Invalid payment address %1").arg(rv.address),
|
||||
CClientUIInterface::MSG_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Just paste the entry, all pre-checks
|
||||
// are done in paymentserver.cpp.
|
||||
pasteEntry(rv);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user