Skip to content

Commit

Permalink
Implement ReturnDestination in DescriptorScriptPubKeyMan
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Apr 23, 2020
1 parent f866957 commit 586b57a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,13 @@ bool DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, bo

void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, const CTxDestination& addr)
{
LOCK(cs_desc_man);
// Only return when the index was the most recent
if (m_wallet_descriptor.next_index - 1 == index) {
m_wallet_descriptor.next_index--;
}
WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor);
NotifyCanGetAddressesChanged();
}

std::map<CKeyID, CKey> DescriptorScriptPubKeyMan::GetKeys() const
Expand Down

0 comments on commit 586b57a

Please sign in to comment.