fix(dsl): handle invalid AbsLockTime without panicking#409
Merged
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom Mar 20, 2026
Merged
fix(dsl): handle invalid AbsLockTime without panicking#409ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
AbsLockTime without panicking#409ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
Conversation
|
ACK, test and clippy pass, maybe change title of PR using conventional commits is good, but all is ok with code |
e9101bc to
937c9e4
Compare
ValuedMammal
requested changes
Mar 18, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #409 +/- ##
==========================================
+ Coverage 79.91% 79.93% +0.01%
==========================================
Files 24 24
Lines 5283 5287 +4
Branches 241 241
==========================================
+ Hits 4222 4226 +4
Misses 984 984
Partials 77 77
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bd3beb0 to
53d928e
Compare
AbsLockTime without panicking
53d928e to
9a0bed7
Compare
Previously, the `after()` macro in the descriptor DSL used `.expect()` when calling `AbsLockTime::from_consensus()`. This caused the macro to panic and crash the program if an invalid value was provided. This commit: - Updates the `after()` macro rule to handle `Result` from `from_consensus`. - Maps `miniscript::AbsLockTimeError` to `DescriptorError::Miniscript`. - Ensures consistency with the `older()` (RelLockTime) error handling. - Adds comprehensive unit tests for valid heights, timestamps, and invalid boundary values. Fixes a potential panic when using the `descriptor!` macro with untrusted or out-of-range absolute locktimes.
9a0bed7 to
6980403
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a potential panic in the descriptor! DSL macro when provided with an invalid absolute locktime. Previously, the
after(<value>)rule used.expect("valid AbsLockTime")onAbsLockTime::from_consensus(). This caused the macro to panic if the value was0or exceeded theMAX_ABSOLUTE_LOCKTIME. The macro now correctly propagates a Result, ensuring the library remains crash-safe for all inputs.Changelog notice
Fixed
AbsLockTimewithout panickingTesting
Error::AbsLockTimeinstead of terminating the process.Checklist
just pbefore pushingBugfixes:
Related issue
Closes #408
Thanks for the review! This ensures the descriptor! macro is robust against malformed or out-of-range absolute locktime values.