Description:
The descriptor! DSL macro in src/descriptor/dsl.rs previously used .expect("valid RelLockTime") when converting an integer into a miniscript::RelLockTime. RelLockTime::from_consensus() is fallible and
returns an error when the provided value does not fit in the 24-bit field (e.g. 0x80000000). The .expect() caused a panic during macro expansion, leading to a crash in calling code instead of a proper error.
This issue is particularly surprising because:
- String-based descriptor parsing does not perform this validation and accepts arbitrary
u32 values, so users might not realise the macro is more strict.
- The panic leaks through into tests and consumers, making it hard to handle programmatically.
Steps to reproduce:
let _ = descriptor!(wsh(older(0x80000000))).unwrap();
Running the above results in a panic with message valid \RelLockTime``.
Expected behaviour:
The macro should return a Err(DescriptorError::RelLockTime(_)) for out-of-range values, allowing callers to handle the failure.
Description:
The
descriptor!DSL macro insrc/descriptor/dsl.rspreviously used.expect("validRelLockTime")when converting an integer into aminiscript::RelLockTime.RelLockTime::from_consensus()is fallible andreturns an error when the provided value does not fit in the 24-bit field (e.g.
0x80000000). The.expect()caused a panic during macro expansion, leading to a crash in calling code instead of a proper error.This issue is particularly surprising because:
u32values, so users might not realise the macro is more strict.Steps to reproduce:
Running the above results in a panic with message
valid \RelLockTime``.Expected behaviour:
The macro should return a
Err(DescriptorError::RelLockTime(_))for out-of-range values, allowing callers to handle the failure.