The internal script-to-descriptor inference procedure shouldn’t return invalid descriptors or ones that fail the string-to-descriptor parsing process. These two procedures should always support seamless roundtrips.
This inlines InferScript
/InferDescriptor
to the actual descriptors
ParseScript
logic for the multisig path, ensuring only valid descriptors are
produced.
Examples where this presents an issue:
-
Because the legacy wallet allowed the import of invalid scripts, the process could end up inferring and storing an unparsable descriptor, which crashes the software during any subsequent wallet load.
Note: This issue will no longer exist after #31378, because we will discard multisig scripts that are consensus-invalid or descriptors-incompatible prior to calling the descriptors inference procedure but fixing this also at the descriptors level prevents future misuses.
-
The
decodescript()
RPC command currently return unusable multisig descriptors. For example, providing a P2SH multisig redeem script with more than 520 bytes results in a descriptor when it shouldn’t due to its large size.