-
Notifications
You must be signed in to change notification settings - Fork 36.5k
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
lib: Add Taproot support to libconsensus #21158
Conversation
512c9ca
to
883cac2
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.
Thanks for adding this. If the API is bumped, take care to notify library users through mentioning the change in 0.22 release note (doc/release-noted.md
)
@ariard Thanks for the review. Do you have a suggestion about which section the change should be mentioned in? |
@jrawsthorne "Tools and Utilities" sounds good to me. |
883cac2
to
0108629
Compare
0108629
to
28245a8
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.
Code Review ACK 28245a8, thanks for the changes
Up to you to take the nit.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones: If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
🕵️ @harding has been requested to review this pull request as specified in the REVIEWERS file. |
071d933
to
7c85ec9
Compare
@jrawsthorne I think this needs rebase, but that would be cool to land this for downstream projects. |
7c85ec9
to
096ab5c
Compare
Thanks @ariard, rebased |
Code Review ACK 096ab5c. Diff since last ack is swallowing release-note changes. |
@SomberNight I guess you're also interested to for downstream support, if you have time to review again, that would be cool :) |
096ab5c
to
6983919
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.
utACK 6983919
6983919
to
c23996a
Compare
std::vector<CTxOut> spent_outputs; | ||
if (spentOutputs != nullptr) { | ||
TxInputStream spent_outputs_stream(PROTOCOL_VERSION, spentOutputs, spentOutputsLen); | ||
spent_outputs_stream >> spent_outputs; |
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.
Might be nicer to let the caller pass in an array rather than have to serialise the vector?
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.
Correct me if I'm wrong but I thought it would have to be a vector and that can't be exposed as part of the C API
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.
It could take in a pointer to an array of {pointer to utxo, length} structs or so, as well as the number of inputs. That's not particularly convenient to use, but neither is the current interface (as it probably requires serialization code on the caller side).
- `int64_t amount` - The amount spent in the input | ||
- `const unsigned char *txTo` - The transaction with the input that is spending the previous output. | ||
- `unsigned int txToLen` - The number of bytes for the `txTo`. | ||
- `const unsigned char *spentOutputs` - Previous outputs spent in the transaction |
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.
This leaves me guessing how to call this function.
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.
Do you want to add something like "serialized as a vector of TxOut" or something more substantial?
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
Marked "up for grabs" |
This change exposes a new function in libconsensus that allows passing spent outputs for Taproot verification. It also adds a VERIFY_TAPROOT flag.
If spent outputs are not provided when the VERIFY_TAPROOT flag is enabled, there is a new error returned SPENT_OUTPUTS_REQUIRED. If the VERIFY_TAPROOT flag is enabled when verify or verify_with_amount then the same error is returned.
I also included testing the consensus lib in the qa asset test.
Closes #21133