Browse Source

rework an ugly hack in processPaymentRequest()

- use a QStringList to store valid addresses and format them for GUI and
  debug.log usage via .join()
0.10
Philip Kaufmann 11 years ago
parent
commit
395d0d5af0
  1. 9
      src/qt/paymentserver.cpp

9
src/qt/paymentserver.cpp

@ -453,16 +453,14 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
request.getMerchant(PaymentServer::certStore, recipient.authenticatedMerchant); request.getMerchant(PaymentServer::certStore, recipient.authenticatedMerchant);
QList<std::pair<CScript, qint64> > sendingTos = request.getPayTo(); QList<std::pair<CScript, qint64> > sendingTos = request.getPayTo();
QStringList addresses;
int i = 0;
foreach(const PAIRTYPE(CScript, qint64)& sendingTo, sendingTos) { foreach(const PAIRTYPE(CScript, qint64)& sendingTo, sendingTos) {
// Extract and check destination addresses // Extract and check destination addresses
CTxDestination dest; CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) { if (ExtractDestination(sendingTo.first, dest)) {
// Append destination address (for payment requests .address is used ONLY for GUI display) // Append destination address
recipient.address.append(QString::fromStdString(CBitcoinAddress(dest).ToString())); addresses.append(QString::fromStdString(CBitcoinAddress(dest).ToString()));
if (i < sendingTos.size() - 1) // prevent new-line for last entry
recipient.address.append("<br />");
} }
else if (!recipient.authenticatedMerchant.isEmpty()){ else if (!recipient.authenticatedMerchant.isEmpty()){
// Insecure payments to custom bitcoin addresses are not supported // Insecure payments to custom bitcoin addresses are not supported
@ -486,7 +484,6 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
} }
recipient.amount += sendingTo.second; recipient.amount += sendingTo.second;
i++;
} }
// Store addresses and format them to fit nicely into the GUI // Store addresses and format them to fit nicely into the GUI
recipient.address = addresses.join("<br />"); recipient.address = addresses.join("<br />");

Loading…
Cancel
Save