|
|
|
@ -258,22 +258,26 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
|
|
|
|
|
// and emit coinsSent signal for each recipient
|
|
|
|
|
foreach(const SendCoinsRecipient &rcp, transaction.getRecipients())
|
|
|
|
|
{
|
|
|
|
|
std::string strAddress = rcp.address.toStdString();
|
|
|
|
|
CTxDestination dest = CBitcoinAddress(strAddress).Get();
|
|
|
|
|
std::string strLabel = rcp.label.toStdString();
|
|
|
|
|
// Don't touch the address book when we have a secure payment-request
|
|
|
|
|
if (rcp.authenticatedMerchant.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
LOCK(wallet->cs_wallet);
|
|
|
|
|
|
|
|
|
|
std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(dest);
|
|
|
|
|
|
|
|
|
|
// Check if we have a new address or an updated label
|
|
|
|
|
if (mi == wallet->mapAddressBook.end())
|
|
|
|
|
{
|
|
|
|
|
wallet->SetAddressBook(dest, strLabel, "send");
|
|
|
|
|
}
|
|
|
|
|
else if (mi->second.name != strLabel)
|
|
|
|
|
std::string strAddress = rcp.address.toStdString();
|
|
|
|
|
CTxDestination dest = CBitcoinAddress(strAddress).Get();
|
|
|
|
|
std::string strLabel = rcp.label.toStdString();
|
|
|
|
|
{
|
|
|
|
|
wallet->SetAddressBook(dest, strLabel, ""); // "" means don't change purpose
|
|
|
|
|
LOCK(wallet->cs_wallet);
|
|
|
|
|
|
|
|
|
|
std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(dest);
|
|
|
|
|
|
|
|
|
|
// Check if we have a new address or an updated label
|
|
|
|
|
if (mi == wallet->mapAddressBook.end())
|
|
|
|
|
{
|
|
|
|
|
wallet->SetAddressBook(dest, strLabel, "send");
|
|
|
|
|
}
|
|
|
|
|
else if (mi->second.name != strLabel)
|
|
|
|
|
{
|
|
|
|
|
wallet->SetAddressBook(dest, strLabel, ""); // "" means don't change purpose
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
emit coinsSent(wallet, rcp, transaction_array);
|
|
|
|
|