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

Why do we have two SigHashTypes? #670

Closed
dr-orlovsky opened this issue Sep 29, 2021 · 7 comments · Fixed by #702
Closed

Why do we have two SigHashTypes? #670

dr-orlovsky opened this issue Sep 29, 2021 · 7 comments · Fixed by #702
Labels
Projects
Milestone

Comments

@dr-orlovsky
Copy link
Collaborator

First one:

https://github.com/rust-bitcoin/rust-bitcoin/blob/master/src/blockdata/transaction.rs#L676-L695

Second one:

https://github.com/rust-bitcoin/rust-bitcoin/blob/master/src/util/sighash.rs#L102-L126

@dr-orlovsky dr-orlovsky added this to the 0.28.0 milestone Sep 29, 2021
@dr-orlovsky dr-orlovsky added this to To do in Refactoring via automation Sep 29, 2021
@RCasatta
Copy link
Collaborator

RCasatta commented Sep 29, 2021

The second one has the Reserved variant, here are some comments about it:

#628 (comment)

Nobody was super-sure about it, we can decide to remove it before release

@RCasatta
Copy link
Collaborator

Sorry, my previous comment was pertinent but not the real reason, the real reason it's the Default variant added in Bip341

@dr-orlovsky
Copy link
Collaborator Author

Can we somehow differentiate them by name, do a deprecated stuff on the old one or add necessary doc explanations on the choice of the structure?

@apoelstra
Copy link
Member

Lol, let's just remove the one in transaction.rs

@sanket1729
Copy link
Member

Lol, let's just remove the one in transaction.rs

If we do so, we would have to add checks to existing methods to not use the new variants. At which I think that having two separate types is the correct thing.

@dr-orlovsky
Copy link
Collaborator Author

If we have to maintain both structures we need to differentiate them by name and clearly describe the purpose of both in the docs

@RCasatta
Copy link
Collaborator

RCasatta commented Oct 5, 2021

Also, I think we are re-exporting the legacy one

pub use blockdata::transaction::SigHashType;

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

Successfully merging a pull request may close this issue.

4 participants