MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetAddressUsed

Method SetAddressUsed

src/wallet/wallet.cpp:2830–2844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2828}
2829
2830bool 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
2846void CWallet::LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value)
2847{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 6

FindKeyFunction · 0.85
EncodeDestinationFunction · 0.85
EraseDestDataMethod · 0.80
WriteDestDataMethod · 0.80
eraseMethod · 0.45
insertMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64