Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.cpp
| Show First 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | for (const SendCoinsRecipient &rcp : recipients) { | ||||
| return InvalidAddress; | return InvalidAddress; | ||||
| } | } | ||||
| if (rcp.amount <= Amount(0)) { | if (rcp.amount <= Amount(0)) { | ||||
| return InvalidAmount; | return InvalidAmount; | ||||
| } | } | ||||
| setAddress.insert(rcp.address); | setAddress.insert(rcp.address); | ||||
| ++nAddresses; | ++nAddresses; | ||||
| CScript scriptPubKey = GetScriptForDestination( | CScript scriptPubKey = GetScriptForDestination(DecodeDestination( | ||||
| DecodeDestination(rcp.address.toStdString())); | rcp.address.toStdString(), wallet->chainParams)); | ||||
| CRecipient recipient = {scriptPubKey, Amount(rcp.amount), | CRecipient recipient = {scriptPubKey, Amount(rcp.amount), | ||||
| rcp.fSubtractFeeFromAmount}; | rcp.fSubtractFeeFromAmount}; | ||||
| vecSend.push_back(recipient); | vecSend.push_back(recipient); | ||||
| total += rcp.amount; | total += rcp.amount; | ||||
| } | } | ||||
| } | } | ||||
| if (setAddress.size() != nAddresses) { | if (setAddress.size() != nAddresses) { | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | WalletModel::sendCoins(WalletModelTransaction &transaction) { | ||||
| } | } | ||||
| // Add addresses / update labels that we've sent to to the address book, and | // Add addresses / update labels that we've sent to to the address book, and | ||||
| // emit coinsSent signal for each recipient | // emit coinsSent signal for each recipient | ||||
| for (const SendCoinsRecipient &rcp : transaction.getRecipients()) { | for (const SendCoinsRecipient &rcp : transaction.getRecipients()) { | ||||
| // Don't touch the address book when we have a payment request | // Don't touch the address book when we have a payment request | ||||
| if (!rcp.paymentRequest.IsInitialized()) { | if (!rcp.paymentRequest.IsInitialized()) { | ||||
| std::string strAddress = rcp.address.toStdString(); | std::string strAddress = rcp.address.toStdString(); | ||||
| CTxDestination dest = DecodeDestination(strAddress); | CTxDestination dest = | ||||
| DecodeDestination(strAddress, wallet->chainParams); | |||||
| std::string strLabel = rcp.label.toStdString(); | std::string strLabel = rcp.label.toStdString(); | ||||
| { | { | ||||
| LOCK(wallet->cs_wallet); | LOCK(wallet->cs_wallet); | ||||
| std::map<CTxDestination, CAddressBookData>::iterator mi = | std::map<CTxDestination, CAddressBookData>::iterator mi = | ||||
| wallet->mapAddressBook.find(dest); | wallet->mapAddressBook.find(dest); | ||||
| // Check if we have a new address or an updated label | // Check if we have a new address or an updated label | ||||
| ▲ Show 20 Lines • Show All 297 Lines • ▼ Show 20 Lines | for (const std::pair<CTxDestination, CAddressBookData> &item : | ||||
| item2.first.substr(0, 2) == "rr") // receive request | item2.first.substr(0, 2) == "rr") // receive request | ||||
| vReceiveRequests.push_back(item2.second); | vReceiveRequests.push_back(item2.second); | ||||
| } | } | ||||
| } | } | ||||
| bool WalletModel::saveReceiveRequest(const std::string &sAddress, | bool WalletModel::saveReceiveRequest(const std::string &sAddress, | ||||
| const int64_t nId, | const int64_t nId, | ||||
| const std::string &sRequest) { | const std::string &sRequest) { | ||||
| CTxDestination dest = DecodeDestination(sAddress); | CTxDestination dest = DecodeDestination(sAddress, wallet->chainParams); | ||||
| std::stringstream ss; | std::stringstream ss; | ||||
| ss << nId; | ss << nId; | ||||
| // "rr" prefix = "receive request" in destdata | // "rr" prefix = "receive request" in destdata | ||||
| std::string key = "rr" + ss.str(); | std::string key = "rr" + ss.str(); | ||||
| LOCK(wallet->cs_wallet); | LOCK(wallet->cs_wallet); | ||||
| if (sRequest.empty()) | if (sRequest.empty()) | ||||
| Show All 30 Lines | |||||