From 2ae1788dd46a71cb47ec25e149ea11fa8689c64f Mon Sep 17 00:00:00 2001 From: Novo Date: Thu, 24 Apr 2025 19:53:51 +0100 Subject: [PATCH] Skip range verification for non-ranged desc Non-range desc are always added to the wallet with the range [0,0]. After the descriptor is added, the wallet will TopUp the keypool. For non-range descriptors, this process updates the desc range to [0,1]. Any attempts to update this non-range descriptor with a [0,0] range will result in an error because the range checks rejects new ranges not included in the old range. Since this is a non-range desc, the range information should be disregarded and AddWalletDescriptor should always succeed regardless of provided range information --- src/wallet/scriptpubkeyman.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 80f25c62c2b..cf0f370bcbe 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -2852,6 +2852,11 @@ bool DescriptorScriptPubKeyMan::CanUpdateToWalletDescriptor(const WalletDescript return false; } + if (!descriptor.descriptor->IsRange()) { + // Skip range check for non-range descriptors + return true; + } + if (descriptor.range_start > m_wallet_descriptor.range_start || descriptor.range_end < m_wallet_descriptor.range_end) { // Use inclusive range for error