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

Improve SighashCache API #1625

Merged
merged 2 commits into from Feb 7, 2023
Merged

Conversation

Kixunil
Copy link
Collaborator

@Kixunil Kixunil commented Feb 6, 2023

This changes the bound from Deref<Target = Transaction> to Borrow<Transaction> (with respective mut changes) and adds accessors.

Closes #1423 (PSBT stuff will be separate issue).

@Kixunil Kixunil added the API break This PR requires a version bump for the next release label Feb 6, 2023
@Kixunil Kixunil added this to the 0.30.0 milestone Feb 6, 2023
The requirement for a type dereferencing to `Transaction` prevented
storing the cache in long-lived data without resorting to silly
wrappers. Since `Borrow` is implemented both for `T` and for smart
pointers it's a more flexible bound which this change implements.

While this is technically breaking, all usual non-generic code will
continue to work beause smart pointers generally have `Borrow`
implemented.
It may be useful to access the transaction stored in `SighashCache`
during signing or afterwards, especially when the transaction is stored
without indirection (to enable long-lived storage).

This change adds the appropriate accessors.
@tcharding
Copy link
Member

Needs #1610

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b3188bb

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b3188bb

@apoelstra apoelstra merged commit 0aba8e5 into rust-bitcoin:master Feb 7, 2023
@Kixunil Kixunil deleted the sighas-borrow branch February 9, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API break This PR requires a version bump for the next release release notes mention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve SigHashCache API to allow storing the cache
3 participants