diff options
Diffstat (limited to 'src/qt/paymentserver.cpp')
-rw-r--r-- | src/qt/paymentserver.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 75a8c03c01..b153decd1f 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -94,7 +94,7 @@ static void ReportInvalidCertificate(const QSslCertificate& cert) } // -// Load openSSL's list of root certificate authorities +// Load OpenSSL's list of root certificate authorities // void PaymentServer::LoadRootCAs(X509_STORE* _store) { @@ -149,7 +149,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store) const unsigned char *data = (const unsigned char *)certData.data(); X509* x509 = d2i_X509(0, &data, certData.size()); - if (x509 && X509_STORE_add_cert( PaymentServer::certStore, x509)) + if (x509 && X509_STORE_add_cert(PaymentServer::certStore, x509)) { // Note: X509_STORE_free will free the X509* objects when // the PaymentServer is destroyed @@ -305,18 +305,20 @@ bool PaymentServer::eventFilter(QObject *, QEvent *event) return false; } -void PaymentServer::initNetManager(const OptionsModel& options) +void PaymentServer::initNetManager() { + if (!optionsModel) + return; if (netManager != NULL) delete netManager; // netManager is used to fetch paymentrequests given in bitcoin: URI's netManager = new QNetworkAccessManager(this); - // Use proxy settings from options: + // Use proxy settings from optionsModel: QString proxyIP; quint16 proxyPort; - if (options.getProxySettings(proxyIP, proxyPort)) + if (optionsModel->getProxySettings(proxyIP, proxyPort)) { QNetworkProxy proxy; proxy.setType(QNetworkProxy::Socks5Proxy); @@ -437,13 +439,16 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList<SendCoinsRecipient>& recipients) { + if (!optionsModel) + return false; + QList<std::pair<CScript,qint64> > sendingTos = request.getPayTo(); qint64 totalAmount = 0; foreach(const PAIRTYPE(CScript, qint64)& sendingTo, sendingTos) { CTxOut txOut(sendingTo.second, sendingTo.first); if (txOut.IsDust(CTransaction::nMinRelayTxFee)) { QString message = QObject::tr("Requested payment amount (%1) too small") - .arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, sendingTo.second)); + .arg(BitcoinUnits::formatWithUnit(optionsModel->getDisplayUnit(), sendingTo.second)); qDebug() << message; emit reportError(tr("Payment request error"), message, CClientUIInterface::MODAL); return false; @@ -535,7 +540,7 @@ PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QB } else { CPubKey newKey; - if (wallet->GetKeyFromPool(newKey, false)) { + if (wallet->GetKeyFromPool(newKey)) { CKeyID keyID = newKey.GetID(); wallet->SetAddressBook(keyID, strAccount, "refund"); @@ -618,3 +623,8 @@ PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError> &err } emit reportError(tr("Network request error"), errString, CClientUIInterface::MODAL); } + +void PaymentServer::setOptionsModel(OptionsModel *optionsModel) +{ + this->optionsModel = optionsModel; +} |