Summary
- Extract descriptor validation into a separate
ValidateDescriptorImport()function - Run a validation pass over all descriptors before importing any, so users get immediate error feedback without waiting for a potentially lengthy blockchain rescan
- If any descriptor fails validation, return immediately — no wallet modifications or rescan are performed
- Follows pinheadmz’s suggested approach from #33655: “separate the validation into a separate function entirely, so we validate in a loop first then process in a second loop”
- There’s code duplication between ValidateDescriptorImport and the first half of ProcessDescriptorImport. Happy to consolidate if requested.
- Addresses achow101’s concern from #33874: descriptors that were not actually imported never return
success: true
fixes #33655
Test plan
- New functional test in
wallet_importdescriptors.pyverifies batch validation behavior - All existing
wallet_importdescriptors.pytests pass - Unit tests pass