MCPcopy Create free account
hub / github.com/LUX-Core/lux / SetAddressBook

Method SetAddressBook

src/wallet.cpp:3504–3522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3502
3503
3504bool CWallet::SetAddressBook(const CTxDestination& address, const string& strName, const string& strPurpose)
3505{
3506 bool fUpdated = false;
3507 {
3508 LOCK(cs_wallet); // mapAddressBook
3509 std::map<CTxDestination, CAddressBookData>::iterator mi = mapAddressBook.find(address);
3510 fUpdated = mi != mapAddressBook.end();
3511 mapAddressBook[address].name = strName;
3512 if (!strPurpose.empty()) /* update purpose only if requested */
3513 mapAddressBook[address].purpose = strPurpose;
3514 }
3515 NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address) != ISMINE_NO,
3516 strPurpose, (fUpdated ? CT_UPDATED : CT_NEW));
3517 if (!fFileBacked)
3518 return false;
3519 if (!strPurpose.empty() && !CWalletDB(strWalletFile).WritePurpose(EncodeDestination(address), strPurpose))
3520 return false;
3521 return CWalletDB(strWalletFile).WriteName(EncodeDestination(address), strName);
3522}
3523
3524bool CWallet::DelAddressBook(const CTxDestination& address)
3525{

Callers 15

getnewaddressFunction · 0.80
setaccountFunction · 0.80
addmultisigaddressFunction · 0.80
AppInit2Function · 0.80
importprivkeyFunction · 0.80
ImportScriptFunction · 0.80
ImportAddressFunction · 0.80
importwalletFunction · 0.80
bip38decryptFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
on_okButton_clickedMethod · 0.80
Q_FOREACHFunction · 0.80

Calls 9

NotifyAddressBookChangedFunction · 0.85
IsMineFunction · 0.85
CWalletDBClass · 0.85
EncodeDestinationFunction · 0.85
WritePurposeMethod · 0.80
WriteNameMethod · 0.80
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64