-
Notifications
You must be signed in to change notification settings - Fork 155
Fix up mixup of age/height #424
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
Fix up mixup of age/height #424
Conversation
Are we actually using |
4466a8b
to
06d7c53
Compare
We are passing `csv` and `cltv` variables to `from_txdata` in the wrong order. While we are at it, add code comments linking age/csv and height/cltv.
The function takes as a parameter that represents the argument from `OP_CLTV`, this is a height _or_ time. Improve the function name to reflect this.
The parameter to `to_age` represents either a number of blocks _or_ a time (medium time passed). The term 'age' is associated with relative time locks in general. Use 'age' as the parameter name instead of 'time'.
We are passing the wrong fields into `evaluate_after` and `evaluate_older`. 'after' is associated with _absolute_ timelocks, this means 'height'. 'older' is associated with _relative_ timelocks, this means 'height'.
8fa8cdc
to
3d76d02
Compare
Done reviewing 3d76d02. I'm still confused by the logic in the last commit ... it seems like we are using "height" vs "age", which as I've mentioned in my first comment, seems like a wrong way to classify. But maybe this should be fixed in a later PR? This PR is definitely an improvement. |
I'm trying to detangle things here in rust-miniscript while simultaneously creating the new 'timelocks' API in rust-bitcoin. I'm held back by the fact that I keep getting confused, for the last two weeks I thought 'age' went with CLTV, only after your original comment on this PR did I realize the mix ups we had.
I thought I was in line with your original comment, the last commit fixes the fact that we pass the wrong value to I'm taking baby steps, mainly focusing on CLTV. The weakness in this approach is I'm not 100% across all the intricacies of CSV right at this minute so this might mean some churn when I move onto that part of the timelocks. |
|
I think we are on the same page, I believe the PR is correct, and believe that patch 1 and 4 are rectifying real bugs. Oooooh, I finally get your comments, you mean to say that you would expect this PR to include a change to the field names of |
I pushed an additional patch that removes |
c7483cc
to
454db6e
Compare
Currently we are using the identifier `height` for the CLTV vaule. This is incorrect because the value can be either a height or time. There is also a risk of mixing up the value with the CSV `age` value. Use `lock_time` to clearly disambiguate the CLTV value.
454db6e
to
fec8014
Compare
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.
ACK fec8014
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.
utACK fec8014
We currently use age/height as identifiers for values related to CLTV and CSV. However we get them mixed up in the function call to
from_txdata
. Do a few improvements to fix the mixup and improve the overall situation.(This description and PR are totally re-written, the comment directly below is now stale.)