MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / getAddress

Method getAddress

src/wallet/interfaces.cpp:185–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183 return m_wallet->DelAddressBook(dest);
184 }
185 bool getAddress(const CTxDestination& dest,
186 std::string* name,
187 AddressPurpose* purpose) override
188 {
189 LOCK(m_wallet->cs_wallet);
190 const auto& entry = m_wallet->FindAddressBookEntry(dest, /*allow_change=*/false);
191 if (!entry) return false; // addr not found
192 if (name) {
193 *name = entry->GetLabel();
194 }
195 if (purpose) {
196 // In very old wallets, address purpose may not be recorded so we derive it from IsMine
197 *purpose = entry->purpose.value_or(m_wallet->IsMine(dest) ? AddressPurpose::RECEIVE : AddressPurpose::SEND);
198 }
199 return true;
200 }
201 std::vector<WalletAddress> getAddresses() override
202 {
203 LOCK(m_wallet->cs_wallet);

Callers

nothing calls this directly

Calls 4

FindAddressBookEntryMethod · 0.80
GetLabelMethod · 0.80
value_orMethod · 0.45
IsMineMethod · 0.45

Tested by

no test coverage detected