| 2393 | } |
| 2394 | |
| 2395 | bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& address, const std::string& strName, const std::string& strPurpose) |
| 2396 | { |
| 2397 | bool fUpdated = false; |
| 2398 | bool is_mine; |
| 2399 | { |
| 2400 | LOCK(cs_wallet); |
| 2401 | std::map<CTxDestination, CAddressBookData>::iterator mi = m_address_book.find(address); |
| 2402 | fUpdated = (mi != m_address_book.end() && !mi->second.IsChange()); |
| 2403 | m_address_book[address].SetLabel(strName); |
| 2404 | if (!strPurpose.empty()) /* update purpose only if requested */ |
| 2405 | m_address_book[address].purpose = strPurpose; |
| 2406 | is_mine = IsMine(address) != ISMINE_NO; |
| 2407 | } |
| 2408 | NotifyAddressBookChanged(address, strName, is_mine, |
| 2409 | strPurpose, (fUpdated ? CT_UPDATED : CT_NEW)); |
| 2410 | if (!strPurpose.empty() && !batch.WritePurpose(EncodeDestination(address), strPurpose)) |
| 2411 | return false; |
| 2412 | return batch.WriteName(EncodeDestination(address), strName); |
| 2413 | } |
| 2414 | |
| 2415 | bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& strName, const std::string& strPurpose) |
| 2416 | { |
nothing calls this directly
no test coverage detected