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
422b83c interpreter: use `relative::LockTime` for constraints from Miniscript (Andrew Poelstra)
fc42e48 miniscript: use RelLockTime in Terminal (Andrew Poelstra)
c490f49 policy: use `RelLockTime` in semantic and concrete policies (Andrew Poelstra)
a7a1b9a miniscript: use RelLockTime in `Satisfaction` (Andrew Poelstra)
fc6bfa8 introduce RelLockTime type (Andrew Poelstra)
637720a plan/satisfy: use relative::LockTime instead of Sequence to indicate relative locktimes (Andrew Poelstra)
bd6ef65 interpreter: rename "age" to "sequence" (Andrew Poelstra)
950b793 AbsLockTime: move to module, consolidate error checking (Andrew Poelstra)
60d7c98 types: drop unused "strongness" errors (Andrew Poelstra)
2f66778 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 422b83c
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