diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-15 23:48:47 -0700 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-15 23:48:47 -0700 |
commit | a2bb571c4f03a7763f9170de66c59b6bd25116e2 (patch) | |
tree | 3dd844c1591099669ded0b0b7f153e861c3bd7bf /src/qt/walletmodel.cpp | |
parent | 03db5c6112541302ae4a3901c2d02b2a1c37c7e3 (diff) | |
parent | 48c011489b047389e7c1c3aa8634de5133ec5b5c (diff) |
Merge pull request #3069 from Diapolo/fix_addressbook
don't touch addressbook when using secure payment-requests
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r-- | src/qt/walletmodel.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 099fbe8dc3..417bac9928 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -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); |