Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.cpp
Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | WalletModel::prepareTransaction(WalletModelTransaction &transaction, | ||||
} | } | ||||
// Used to detect duplicates | // Used to detect duplicates | ||||
QSet<QString> setAddress; | QSet<QString> setAddress; | ||||
int nAddresses = 0; | int nAddresses = 0; | ||||
// Pre-check input data for validity | // Pre-check input data for validity | ||||
for (const SendCoinsRecipient &rcp : recipients) { | for (const SendCoinsRecipient &rcp : recipients) { | ||||
if (rcp.fSubtractFeeFromAmount) fSubtractFeeFromAmount = true; | if (rcp.fSubtractFeeFromAmount) { | ||||
fSubtractFeeFromAmount = true; | |||||
} | |||||
#ifdef ENABLE_BIP70 | #ifdef ENABLE_BIP70 | ||||
// PaymentRequest... | // PaymentRequest... | ||||
if (rcp.paymentRequest.IsInitialized()) { | if (rcp.paymentRequest.IsInitialized()) { | ||||
Amount subtotal = Amount::zero(); | Amount subtotal = Amount::zero(); | ||||
const payments::PaymentDetails &details = | const payments::PaymentDetails &details = | ||||
rcp.paymentRequest.getDetails(); | rcp.paymentRequest.getDetails(); | ||||
for (int i = 0; i < details.outputs_size(); i++) { | for (int i = 0; i < details.outputs_size(); i++) { | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | #ifdef ENABLE_BIP70 | ||||
} | } | ||||
// Store PaymentRequests in wtx.vOrderForm in wallet. | // Store PaymentRequests in wtx.vOrderForm in wallet. | ||||
std::string value; | std::string value; | ||||
rcp.paymentRequest.SerializeToString(&value); | rcp.paymentRequest.SerializeToString(&value); | ||||
vOrderForm.emplace_back("PaymentRequest", std::move(value)); | vOrderForm.emplace_back("PaymentRequest", std::move(value)); | ||||
} else | } else | ||||
#endif | #endif | ||||
{ | |||||
if (!rcp.message.isEmpty()) { | if (!rcp.message.isEmpty()) { | ||||
// Message from normal bitcoincash:URI | // Message from normal bitcoincash:URI | ||||
// (bitcoincash:123...?message=example) | // (bitcoincash:123...?message=example) | ||||
vOrderForm.emplace_back("Message", rcp.message.toStdString()); | vOrderForm.emplace_back("Message", rcp.message.toStdString()); | ||||
} | } | ||||
} | } | ||||
} | |||||
auto &newTx = transaction.getWtx(); | auto &newTx = transaction.getWtx(); | ||||
std::string rejectReason; | std::string rejectReason; | ||||
if (!newTx->commit({} /* mapValue */, std::move(vOrderForm), | if (!newTx->commit({} /* mapValue */, std::move(vOrderForm), | ||||
{} /* fromAccount */, rejectReason)) { | {} /* fromAccount */, rejectReason)) { | ||||
return SendCoinsReturn(TransactionCommitFailed, | return SendCoinsReturn(TransactionCommitFailed, | ||||
QString::fromStdString(rejectReason)); | QString::fromStdString(rejectReason)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |