| 2535 | } |
| 2536 | |
| 2537 | bool CWallet::DelAddressBookWithDB(WalletBatch& batch, const CTxDestination& address) |
| 2538 | { |
| 2539 | const std::string& dest = EncodeDestination(address); |
| 2540 | { |
| 2541 | LOCK(cs_wallet); |
| 2542 | // If we want to delete receiving addresses, we should avoid calling EraseAddressData because it will delete the previously_spent value. Could instead just erase the label so it becomes a change address, and keep the data. |
| 2543 | // NOTE: This isn't a problem for sending addresses because they don't have any data that needs to be kept. |
| 2544 | // When adding new address data, it should be considered here whether to retain or delete it. |
| 2545 | if (IsMine(address)) { |
| 2546 | WalletLogPrintf("%s called with IsMine address, NOT SUPPORTED. Please report this bug! %s\n", __func__, CLIENT_BUGREPORT); |
| 2547 | return false; |
| 2548 | } |
| 2549 | // Delete data rows associated with this address |
| 2550 | if (!batch.EraseAddressData(address)) { |
| 2551 | WalletLogPrintf("Error: cannot erase address book entry data\n"); |
| 2552 | return false; |
| 2553 | } |
| 2554 | |
| 2555 | // Delete purpose entry |
| 2556 | if (!batch.ErasePurpose(dest)) { |
| 2557 | WalletLogPrintf("Error: cannot erase address book entry purpose\n"); |
| 2558 | return false; |
| 2559 | } |
| 2560 | |
| 2561 | // Delete name entry |
| 2562 | if (!batch.EraseName(dest)) { |
| 2563 | WalletLogPrintf("Error: cannot erase address book entry name\n"); |
| 2564 | return false; |
| 2565 | } |
| 2566 | |
| 2567 | // finally, remove it from the map |
| 2568 | m_address_book.erase(address); |
| 2569 | } |
| 2570 | |
| 2571 | // All good, signal changes |
| 2572 | NotifyAddressBookChanged(address, "", /*is_mine=*/false, AddressPurpose::SEND, CT_DELETED); |
| 2573 | return true; |
| 2574 | } |
| 2575 | |
| 2576 | size_t CWallet::KeypoolCountExternalKeys() const |
| 2577 | { |
nothing calls this directly
no test coverage detected