| 2828 | } |
| 2829 | |
| 2830 | bool CWallet::SetAddressUsed(WalletBatch& batch, const CTxDestination& dest, bool used) |
| 2831 | { |
| 2832 | const std::string key{"used"}; |
| 2833 | if (std::get_if<CNoDestination>(&dest)) |
| 2834 | return false; |
| 2835 | |
| 2836 | if (!used) { |
| 2837 | if (auto* data = util::FindKey(m_address_book, dest)) data->destdata.erase(key); |
| 2838 | return batch.EraseDestData(EncodeDestination(dest), key); |
| 2839 | } |
| 2840 | |
| 2841 | const std::string value{"1"}; |
| 2842 | m_address_book[dest].destdata.insert(std::make_pair(key, value)); |
| 2843 | return batch.WriteDestData(EncodeDestination(dest), key, value); |
| 2844 | } |
| 2845 | |
| 2846 | void CWallet::LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value) |
| 2847 | { |