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
This commit is contained in:
Novo 2025-04-24 19:53:51 +01:00
parent 458720e5e9
commit 2ae1788dd4

View file

@ -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