-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(wallet): create tx locktime cltv for a specific time #1682
base: master
Are you sure you want to change the base?
Conversation
/// the parameter passed to miniscript fragment `after` has to equal or grather than 500_000_000 | ||
/// in order to use a lock based on unix time | ||
pub fn get_test_single_sig_cltv_for_specific_time() -> &'static str { | ||
"wsh(and_v(v:pk(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW),after(500000000)))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ just a nit but we should use a timestamp that's sometime after the genesis block. Sometimes people use these tests as examples so will make more sense to use a more recent time. Also the number is easier to read in the code with the underscores.
"wsh(and_v(v:pk(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW),after(500000000)))" | |
"wsh(and_v(v:pk(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW),after(1_734_230_218)))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to update the descriptor as you mentioned, but there is an error with the format:
descriptors must be valid: Miniscript(Unexpected("unexpected «1_734_230_218»"))
It looks like miniscript does not have support for numbers with underscores.
@@ -160,6 +160,13 @@ pub fn get_test_single_sig_cltv() -> &'static str { | |||
"wsh(and_v(v:pk(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW),after(100000)))" | |||
} | |||
|
|||
/// `wsh` descriptor with policy `and(pk(A),after(500_000_000))` | |||
/// the parameter passed to miniscript fragment `after` has to equal or grather than 500_000_000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// the parameter passed to miniscript fragment `after` has to equal or grather than 500_000_000 | |
/// the parameter passed to miniscript fragment `after` has to equal or greater than 500_000_000 |
Description
This PR adds a unit test that checks the satisfaction of timestamp-based timelocks. The goal is to test the absolute time therefore the variable passed to the miniscript fragment
after
has to be equal to or greater that 500_000_000 otherwise it would be checking the block height.Notes to the reviewers
This unit test tries to check if #642 is still an issue.
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing