Merge bitcoin/bitcoin#32344: Wallet: Fix Non-Ranged Descriptors with Range [0,0] Trigger Unexpected Wallet Errors in AddWalletDescriptor

97d383af6d Test updating non-ranged descriptor with [0,0] range succeeds (Novo)
2ae1788dd4 Skip range verification for non-ranged desc (Novo)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/31728

  This PR updates the `DescriptorScriptPubKeyMan` to skip range checks for non-ranged descriptors, which previously caused errors when updating a non-ranged descriptor with the range [0,0]

  #### Testing
  A unit test was added to test the new behaviour

ACKs for top commit:
  achow101:
    ACK 97d383af6d
  rkrux:
    ACK 97d383a

Tree-SHA512: 6dbd058376d9e57d26477d9d6d89646e80a32e3ffcc9f4e30eeda273575d12583ce520cc0032cc67c12ea0b3ad344fbd3945d9fc5e389b6a6bce1ea7ad5d6e59
This commit is contained in:
Ava Chow
2025-05-20 12:30:52 -07:00
2 changed files with 24 additions and 0 deletions

View File

@@ -1598,6 +1598,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