Changeset View
Changeset View
Standalone View
Standalone View
src/qt/paymentserver.cpp
Show First 20 Lines • Show All 566 Lines • ▼ Show 20 Lines | for (const std::pair<CScript, CAmount> &sendingTo : sendingTos) { | ||||
if (!verifyAmount(sendingTo.second)) { | if (!verifyAmount(sendingTo.second)) { | ||||
Q_EMIT message(tr("Payment request rejected"), | Q_EMIT message(tr("Payment request rejected"), | ||||
tr("Invalid payment request."), | tr("Invalid payment request."), | ||||
CClientUIInterface::MSG_ERROR); | CClientUIInterface::MSG_ERROR); | ||||
return false; | return false; | ||||
} | } | ||||
// Extract and check amounts | // Extract and check amounts | ||||
CTxOut txOut(sendingTo.second, sendingTo.first); | CTxOut txOut(Amount(sendingTo.second), sendingTo.first); | ||||
if (txOut.IsDust(dustRelayFee)) { | if (txOut.IsDust(dustRelayFee)) { | ||||
Q_EMIT message( | Q_EMIT message( | ||||
tr("Payment request error"), | tr("Payment request error"), | ||||
tr("Requested payment amount of %1 is too small (considered " | tr("Requested payment amount of %1 is too small (considered " | ||||
"dust).") | "dust).") | ||||
.arg(BitcoinUnits::formatWithUnit( | .arg(BitcoinUnits::formatWithUnit( | ||||
optionsModel->getDisplayUnit(), sendingTo.second)), | optionsModel->getDisplayUnit(), sendingTo.second)), | ||||
CClientUIInterface::MSG_ERROR); | CClientUIInterface::MSG_ERROR); | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | if (!fVerified) { | ||||
.arg(__func__) | .arg(__func__) | ||||
.arg(requestSize) | .arg(requestSize) | ||||
.arg(BIP70_MAX_PAYMENTREQUEST_SIZE); | .arg(BIP70_MAX_PAYMENTREQUEST_SIZE); | ||||
} | } | ||||
return fVerified; | return fVerified; | ||||
} | } | ||||
bool PaymentServer::verifyAmount(const CAmount &requestAmount) { | bool PaymentServer::verifyAmount(const CAmount &requestAmount) { | ||||
bool fVerified = MoneyRange(requestAmount); | bool fVerified = MoneyRange(Amount(requestAmount)); | ||||
if (!fVerified) { | if (!fVerified) { | ||||
qWarning() << QString("PaymentServer::%1: Payment request amount out " | qWarning() << QString("PaymentServer::%1: Payment request amount out " | ||||
"of allowed range (%2, allowed 0 - %3).") | "of allowed range (%2, allowed 0 - %3).") | ||||
.arg(__func__) | .arg(__func__) | ||||
.arg(requestAmount) | .arg(requestAmount) | ||||
.arg(MAX_MONEY.GetSatoshis()); | .arg(MAX_MONEY.GetSatoshis()); | ||||
} | } | ||||
return fVerified; | return fVerified; | ||||
} | } | ||||
X509_STORE *PaymentServer::getCertStore() { | X509_STORE *PaymentServer::getCertStore() { | ||||
return certStore.get(); | return certStore.get(); | ||||
} | } |