Skip to content

Commit 586b57a

Browse files
committed
Implement ReturnDestination in DescriptorScriptPubKeyMan
1 parent f866957 commit 586b57a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,13 @@ bool DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, bo
16171617

16181618
void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, const CTxDestination& addr)
16191619
{
1620+
LOCK(cs_desc_man);
1621+
// Only return when the index was the most recent
1622+
if (m_wallet_descriptor.next_index - 1 == index) {
1623+
m_wallet_descriptor.next_index--;
1624+
}
1625+
WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor);
1626+
NotifyCanGetAddressesChanged();
16201627
}
16211628

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

0 commit comments

Comments
 (0)