Skip to content
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

Policy Relative timelocks do not support time based constructions #83

Open
sanket1729 opened this issue May 23, 2023 · 5 comments
Open

Comments

@sanket1729
Copy link
Member

The current Policy enum only supports block based constructions (it's u16 right now). We should also support time based constructions as they are more natural in smart contracts.

@uncomputable
Copy link
Collaborator

Ideally policy includes absolute::Locktime and relative::Locktime. Is the latter implemented for rust-elements? rust-bitcoin wants you to generate relative::Locktime through Sequence. Maybe we should write our own enums.

@apoelstra
Copy link
Collaborator

bitcoin's relative::locktime can be constructed derectly or through serde or from a sequence value. There are also constants like Height::ZERO you can convert. What other constructors should we have?

@uncomputable
Copy link
Collaborator

Should we use bitcoin's structures or elements's? Keeping everything policy-related consistent with Elements might have benefits down the line.

@apoelstra
Copy link
Collaborator

We should use elements structures for everything related to transactions. If structures are missing or they don't match bitcoin we should PR to rust-elements to patch it up. (Though we don't want to put too much work into this -- when we reach rust-bitcoin 1.0 we'll just rewrite rust-elements entirely, so doing a lot af major refactor work before then would be wasted.)

@sanket1729
Copy link
Member Author

I think changing the u16 to u32 should be fine for now. And internally converting should be fine for now.
We can port rust-bitcoin stuff later. Though, I think porting the timelocks files should not be that invasive. Everything is in separate modules in rust-bitcoin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants