test(utils): add boundary tests for Older::check_older and After::check_after#443
test(utils): add boundary tests for Older::check_older and After::check_after#443KrishnaShuk wants to merge 1 commit into
Conversation
| let after = After::new(Some(100_000), false); | ||
| assert!(Satisfier::<PublicKey>::check_after( | ||
| &after, | ||
| absolute::LockTime::from_consensus(100_000) |
There was a problem hiding this comment.
absolute::LockTime can also represent Unix timestamps (>= 500_000_000), but After only has current_height and no current_time. So a timestamp-based locktime would end up being compared against a block height. I also noticed the existing tests don't cover this. Is this intentionally limited to height-based locktimes for now?
There was a problem hiding this comment.
I traced the satisfaction flow further. Timestamp CLTV finalization works; existing wallet tests cover that path, and PsbtInputSatisfier::check_after() evaluates the transaction's lock_time via is_implied_by, which is locktime-type aware.
One thing I noticed: After::check_after() does current_height >= n.to_consensus_u32(), which doesn't distinguish between height- and timestamp-based locktimes. Existing timestamp CLTV tests still pass through the signing/finalization flow.
Description
Addresses the
// TODO: test >= / >on line 111 of utils.rs. Adds 11 boundary-condition tests for theSatisfierimpls of Older and After.Notes to the reviewers
Uses
Satisfier::<PublicKey>::check_older(...)fully-qualified syntax because the trait is generic overPk.Changelog notice
Checklists
All Submissions:
just pbefore pushingNew Features:
Bugfixes: