aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2012-05-03 14:52:15 +0200
committerLuke Dashjr <luke-jr+git@utopios.org>2012-05-06 22:48:05 +0000
commit293f2644ffd98742caa30b16405b95a6420e8ba0 (patch)
treeb1568bdb767486d217d8e86a1bfb978353948c93 /src/qt/walletmodel.cpp
parente38d492822a82fc9f1324f9e08c6ff0627321511 (diff)
fix #952 by checking if we have a new address or an updated label
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r--src/qt/walletmodel.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index f028f10f6c..710d3aa0ad 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -152,14 +152,20 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie
hex = QString::fromStdString(wtx.GetHash().GetHex());
}
- // Add addresses that we've sent to to the address book
+ // Add addresses / update labels that we've sent to to the address book
foreach(const SendCoinsRecipient &rcp, recipients)
{
std::string strAddress = rcp.address.toStdString();
+ std::string strLabel = rcp.label.toStdString();
CRITICAL_BLOCK(wallet->cs_wallet)
{
- if (!wallet->mapAddressBook.count(strAddress))
- wallet->SetAddressBookName(strAddress, rcp.label.toStdString());
+ std::map<CBitcoinAddress, std::string>::iterator mi = wallet->mapAddressBook.find(strAddress);
+
+ // Check if we have a new address or an updated label
+ if (mi == wallet->mapAddressBook.end() || mi->second != strLabel)
+ {
+ wallet->SetAddressBookName(strAddress, strLabel);
+ }
}
}