lib: Add Taproot support to libconsensus#21158
lib: Add Taproot support to libconsensus#21158jrawsthorne wants to merge 4 commits intobitcoin:masterfrom
Conversation
512c9ca to
883cac2
Compare
ariard
left a comment
There was a problem hiding this comment.
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
ariard
left a comment
There was a problem hiding this comment.
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
|
Code Review ACK 7c85ec9. Changes from last ACK is complying VerifyScript call to new MissingDataBehavior introduced by b77b0cc and mention of rust-bitcoin lib. |
|
@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
sipa
left a comment
There was a problem hiding this comment.
utACK 698391966afd0004d6d31fc590ffb8e4222408b8
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.
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.
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.
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.
This leaves me guessing how to call this function.
There was a problem hiding this comment.
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