Skip to content

Commit

Permalink
[wallet] Remove GetLabelDestination
Browse files Browse the repository at this point in the history
Function no longer used.
  • Loading branch information
jnewbery committed Aug 27, 2018
1 parent 7c6f1a1 commit 53038b4
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/wallet/wallet.cpp
Expand Up @@ -796,46 +796,6 @@ int64_t CWallet::IncOrderPosNext(WalletBatch *batch)
return nRet;
}

bool CWallet::GetLabelDestination(CTxDestination &dest, const std::string& label, bool bForceNew)
{
WalletBatch batch(*database);

CAccount account;
batch.ReadAccount(label, account);

if (!bForceNew) {
if (!account.vchPubKey.IsValid())
bForceNew = true;
else {
// Check if the current key has been used (TODO: check other addresses with the same key)
CScript scriptPubKey = GetScriptForDestination(GetDestinationForKey(account.vchPubKey, m_default_address_type));
for (std::map<uint256, CWalletTx>::iterator it = mapWallet.begin();
it != mapWallet.end() && account.vchPubKey.IsValid();
++it)
for (const CTxOut& txout : (*it).second.tx->vout)
if (txout.scriptPubKey == scriptPubKey) {
bForceNew = true;
break;
}
}
}

// Generate a new key
if (bForceNew) {
if (!GetKeyFromPool(account.vchPubKey, false))
return false;

LearnRelatedScripts(account.vchPubKey, m_default_address_type);
dest = GetDestinationForKey(account.vchPubKey, m_default_address_type);
SetAddressBook(dest, label, "receive");
batch.WriteAccount(label, account);
} else {
dest = GetDestinationForKey(account.vchPubKey, m_default_address_type);
}

return true;
}

void CWallet::MarkDirty()
{
{
Expand Down

0 comments on commit 53038b4

Please sign in to comment.