From 0892f16f911d0e2ac7ebf40946b74c2cef485e2c Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Thu, 2 Apr 2026 18:30:46 -0400 Subject: [PATCH] refactor: moveonly: Pair CanGetAddressesChanged notifications with desc range. --- src/wallet/scriptpubkeyman.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 91b45099c4c..ee22746786e 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -986,9 +986,9 @@ void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, // Only return when the index was the most recent if (m_wallet_descriptor.next_index - 1 == index) { m_wallet_descriptor.next_index--; + NotifyCanGetAddressesChanged(); } WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor); - NotifyCanGetAddressesChanged(); } std::map DescriptorScriptPubKeyMan::GetKeys() const @@ -1104,13 +1104,13 @@ bool DescriptorScriptPubKeyMan::TopUpWithDB(WalletBatch& batch, unsigned int siz m_max_cached_index++; } m_wallet_descriptor.range_end = new_range_end; + NotifyCanGetAddressesChanged(); batch.WriteDescriptor(GetID(), m_wallet_descriptor); // By this point, the cache size should be the size of the entire range assert(m_wallet_descriptor.range_end - 1 == m_max_cached_index); m_storage.TopUpCallback(new_spks, this); - NotifyCanGetAddressesChanged(); return true; } @@ -1132,6 +1132,7 @@ std::vector DescriptorScriptPubKeyMan::MarkUnusedAddresses(co ExtractDestination(scripts_temp[0], dest); result.push_back({dest, std::nullopt}); m_wallet_descriptor.next_index++; + NotifyCanGetAddressesChanged(); } } if (!TopUp()) {