Mercurial > hg > bitcoin
changeset 2394:6fcffe69d759 draft
Merge pull request #1189 from Diapolo/fix#952
fix for #952 (send coins tab glitch)
author | Wladimir J. van der Laan <laanwj@gmail.com> |
---|---|
date | Sun, 06 May 2012 14:49:08 -0700 |
parents | 635a1d30480c (current diff) 91c5e61d7ad9 (diff) |
children | 49887056f1f8 |
files | |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -150,14 +150,21 @@ 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(); { LOCK(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); + } } }