You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
422b83cb198976ee0932686dc7dd4bdf396a9c8b interpreter: use `relative::LockTime` for constraints from Miniscript (Andrew Poelstra)
fc42e48022052935f8d657c7e7755513e8d83223 miniscript: use RelLockTime in Terminal (Andrew Poelstra)
c490f49fcb7eab6794b0c40c83d397f8cd02fe2d policy: use `RelLockTime` in semantic and concrete policies (Andrew Poelstra)
a7a1b9a4876e89cfedc2f03130108b107a3864cd miniscript: use RelLockTime in `Satisfaction` (Andrew Poelstra)
fc6bfa8f57cd050d5ab7c887ca9e15928a7c6416 introduce RelLockTime type (Andrew Poelstra)
637720a8280bfdaeb457cd0f7ec364f945f278b7 plan/satisfy: use relative::LockTime instead of Sequence to indicate relative locktimes (Andrew Poelstra)
bd6ef65f8697501b3798cabe9ab0b6a5aa01b761 interpreter: rename "age" to "sequence" (Andrew Poelstra)
950b79389502b045b603903989b8d58c2382cd74 AbsLockTime: move to module, consolidate error checking (Andrew Poelstra)
60d7c98db16a3c41fb9fabdd53545e40b64826e9 types: drop unused "strongness" errors (Andrew Poelstra)
2f667789a72894ac82a3e5a23d5f1b968230f09d types: replace closure with iterator (Andrew Poelstra)
Pull request description:
This PR:
* Changes user-facing "check locktime" functions to use `bitcoin::relative::LockTime` rather than `Sequence` numbers.
* Introduces a new `RelLockTime` type analogous to `AbsLockTime` which is used to provide a locktime type that implements `Ord`.
* In both types, validate that the locktimes are legal for use in Miniscript during creation, rather than during typechecking or validity checks.
* In many places, replace manual code with the new `is_implied_by` method from rust-bitcoin.
This might be a little hard to review because it messes with locktime code which is so easy to get backward. But it appears that there are pretty extensive unit tests which caught several iterations of this where I did get them backward. Going forward things should be much easier to maintain because we have stronger types and an encapsulated `is_implied_by` method.
The next PR will do a similar thing with thresholds to validate the `0 < k <= n` invariant when thresholds are created, avoiding the repeated and inconsistent post-hoc error checking logic.
Fixes #270
ACKs for top commit:
sanket1729:
ACK 422b83cb198976ee0932686dc7dd4bdf396a9c8b
Tree-SHA512: 42a749a405c142c7ec468b2fd2e8c3c559c31e6eacf72a351c4dd24887385fa74d8128982a70cef69489c4ef72d6247860e1cd96e52ec83a00bdee0e3359d9b8
/// At least two BIP389 key expressions in the descriptor contain tuples of
502
505
/// derivation indexes of different lengths.
503
506
MultipathDescLenMismatch,
507
+
/// Invalid absolute locktime
508
+
AbsoluteLockTime(AbsLockTimeError),
509
+
/// Invalid absolute locktime
510
+
RelativeLockTime(RelLockTimeError),
504
511
}
505
512
506
513
// https://github.com/sipa/miniscript/pull/5 for discussion on this number
@@ -576,6 +583,8 @@ impl fmt::Display for Error {
576
583
Error::TrNoScriptCode => write!(f,"No script code for Tr descriptors"),
577
584
Error::TrNoExplicitScript => write!(f,"No script code for Tr descriptors"),
578
585
Error::MultipathDescLenMismatch => write!(f,"At least two BIP389 key expressions in the descriptor contain tuples of derivation indexes of different lengths"),
0 commit comments