This addresses a few review comments from #21365 that were left at the time of merge (as well as some from #22166 applying to the commit it shared with #21365).
I do not think any are blockers for a 22.0 release.
ACK 9336670df5e0b8baa4169f13ba1d242ecae85d26
Checked that the introduced comments match the logic, verified by review that the code-changes are refactor-only (+ an added sanity check in TaprootBuilder::GetSpendData
), built locally, ran unit tests and the functional test feature_taproot.py
.
642 CTxIn& txin = mtx.vin[i];
643 auto coin = coins.find(txin.prevout);
644 if (coin == coins.end() || coin->second.IsSpent()) {
645- have_all_spent_outputs = false;
646+ txdata.Init(txConst, {}, true);
647+ break;
2b19345 suggestion
0@@ -636,11 +636,11 @@ bool SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore,
1
2 PrecomputedTransactionData txdata;
3 std::vector<CTxOut> spent_outputs;
4- for (unsigned int i = 0; i < mtx.vin.size(); i++) {
5+ for (unsigned int i = 0; i < mtx.vin.size(); ++i) {
6 CTxIn& txin = mtx.vin[i];
7 auto coin = coins.find(txin.prevout);
8 if (coin == coins.end() || coin->second.IsSpent()) {
9- txdata.Init(txConst, {}, true);
10+ txdata.Init(txConst, /* spent_outputs */ {}, /* force */ true);
11 break;
12 } else {
13 spent_outputs.emplace_back(coin->second.out.nValue, coin->second.out.scriptPubKey);
14@@ -651,7 +651,7 @@ bool SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore,
15 }
16
17 // Sign what we can:
18- for (unsigned int i = 0; i < mtx.vin.size(); i++) {
19+ for (unsigned int i = 0; i < mtx.vin.size(); ++i) {
20 CTxIn& txin = mtx.vin[i];
171+ *
172+ * @param[in] tx The transaction for which data is being precomputed.
173+ * @param[in] spent_outputs The CTxOuts being spent, one for each tx.vin, in order
174+ * @param[in] force Precompute data for all optional features, regardless of
175+ * what is in the inputs (used at signing time, when the inputs
176+ * aren't filled in yet). */
8b1d3db suggestion
0@@ -170,10 +170,10 @@ struct PrecomputedTransactionData
1 /** Initialize this PrecomputedTransactionData with transaction data.
2 *
3 * [@param](/bitcoin-bitcoin/contributor/param/)[in] tx The transaction for which data is being precomputed.
4- * [@param](/bitcoin-bitcoin/contributor/param/)[in] spent_outputs The CTxOuts being spent, one for each tx.vin, in order
5- * [@param](/bitcoin-bitcoin/contributor/param/)[in] force Precompute data for all optional features, regardless of
6- * what is in the inputs (used at signing time, when the inputs
7- * aren't filled in yet). */
8+ * [@param](/bitcoin-bitcoin/contributor/param/)[in] spent_outputs The CTxOuts being spent, one for each tx.vin, in order.
9+ * [@param](/bitcoin-bitcoin/contributor/param/)[in] force Whether to precompute data for all optional features,
10+ * regardless of what is in the inputs (used at signing
11+ * time, when the inputs aren't filled in yet). */
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, 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.
CKey::SignSchnorr
comment improvement (previously done in commit https://github.com/bitcoin/bitcoin/commit/8b1d3dbfac899c19ab92e3591157d9f4a8c3ca49) is missing now?
These were unused except in tests, and were also overlooked when changing
SIGHASH_ALL -> SIGHASH_DEFAULT.
re-ACK 08f57a0057c58f19cd8ae3de89548d014980478a 🌴
Checked via git range-diff 9336670d...08f57a00
that since my last ACK, the only changes were jonatack’s suggestions w.r.t. to doxygen comments wording and code style (https://github.com/bitcoin/bitcoin/pull/22275#discussion_r659299734, #22275 (review)) plus the rebase on master.
crACK 08f57a0 🧉
LGTM, changes check out and taproot tests passed locally.
git range-diff e9d6eb1 9336670 08f57a0
followed by re-code review per commit to swap context back into memory and debug build/run unit tests + feature_taproot.py as a sanity check