| 2419 | } |
| 2420 | |
| 2421 | bool CWallet::DelAddressBook(const CTxDestination& address) |
| 2422 | { |
| 2423 | bool is_mine; |
| 2424 | WalletBatch batch(GetDatabase()); |
| 2425 | { |
| 2426 | LOCK(cs_wallet); |
| 2427 | // If we want to delete receiving addresses, we need to take care that DestData "used" (and possibly newer DestData) gets preserved (and the "deleted" address transformed into a change entry instead of actually being deleted) |
| 2428 | // NOTE: This isn't a problem for sending addresses because they never have any DestData yet! |
| 2429 | // When adding new DestData, it should be considered here whether to retain or delete it (or move it?). |
| 2430 | if (IsMine(address)) { |
| 2431 | WalletLogPrintf("%s called with IsMine address, NOT SUPPORTED. Please report this bug! %s\n", __func__, PACKAGE_BUGREPORT); |
| 2432 | return false; |
| 2433 | } |
| 2434 | // Delete destdata tuples associated with address |
| 2435 | std::string strAddress = EncodeDestination(address); |
| 2436 | for (const std::pair<const std::string, std::string> &item : m_address_book[address].destdata) |
| 2437 | { |
| 2438 | batch.EraseDestData(strAddress, item.first); |
| 2439 | } |
| 2440 | m_address_book.erase(address); |
| 2441 | is_mine = IsMine(address) != ISMINE_NO; |
| 2442 | } |
| 2443 | |
| 2444 | NotifyAddressBookChanged(address, "", is_mine, "", CT_DELETED); |
| 2445 | |
| 2446 | batch.ErasePurpose(EncodeDestination(address)); |
| 2447 | return batch.EraseName(EncodeDestination(address)); |
| 2448 | } |
| 2449 | |
| 2450 | size_t CWallet::KeypoolCountExternalKeys() const |
| 2451 | { |
no test coverage detected