Repository navigation
wallet, rpc: add v3 transaction creation and wallet support - #32896
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32896. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
0d3a767 to
7fdff3f
Compare
c6cb62e to
7ded135
Compare
eee8695 to
ca97f19
Compare
|
This PR is now ready for review. |
rkrux
left a comment
There was a problem hiding this comment.
lgtm ACK 5c087f58245cfba6b61691ece5387eccf8a1a5f9
Thanks for taking this over the finish line. To implement the TRUC conditions in the wallet, I've observed that the related changes are done in the following control sites of selecting coins while building the transaction via different corresponding RPCs:
FetchSelectedInputs: to ensure the parent-child TRUC versions are in agreement.AvailableCoins: to ensure the parent-child TRUC versions are in agreement, to ensure the TRUC ancestor/descendant limits are adhered to.AutomaticCoinSelection: to ensure the TRUC transaction weight criterion are met.- Notifications -
transactionAddedToMempool,transactionRemovedFromMempool: to ensure transaction mempool conflicts are updated and unconfirmed TRUC child is tracked.
The several functional tests also give more confidence.
The couple nits below can be done if there is any other need to retouch the PR.
In future commits we assume that coin_control.m_version has a value when making sure that we follow truc rules, so we should give it a default value of CTransaction::CURRENT_VERSION.
Adds v3 support to the following RPCs: - createrawtransaction - createpsbt - send - sendall - walletcreatefundedpsbt Co-authored-by: chungeun-choi <cucuridas@gmail.com> Co-authored-by: dongwook-chan <dongwook.chan@gmail.com> Co-authored-by: sean-k1 <uhs2000@naver.com> Co-authored-by: ishaanam <ishaana.misra@gmail.com>
5c087f5 to
5c8bf7b
Compare
|
reACK 5c8bf7b |
achow101
left a comment
There was a problem hiding this comment.
ACK 5c8bf7b
I'm not fully sold on the approach of choosing the highest value TRUC UTXO, but don't have any ideas on how to change that for this PR. Maybe @murchandamus has some thoughts on that.
| const Txid& truc_txid = highest_value_truc_tx->first; | ||
| for (const auto& [type, output] : unconfirmed_truc_coins) { | ||
| if (output.outpoint.hash == truc_txid) { | ||
| result.Add(type, output); |
There was a problem hiding this comment.
In c5a2d08 "wallet: don't return utxos from multiple truc txs in AvailableCoins"
nit: extra indent
Been pondering this a bit today.
We do have the Given that it should be fairly uncommon to have all of your funds in flight and the complexity of alternatives, using the largest UTXO or group of UTXOs feels viable to me, although it could be improved in the future. |
| if (parent_tx.tx->version == TRUC_VERSION && coin_control.m_version != TRUC_VERSION) { | ||
| return util::Error{strprintf(_("Can't spend unconfirmed version 3 pre-selected input with a version %d tx"), coin_control.m_version)}; | ||
| } else if (coin_control.m_version == TRUC_VERSION && parent_tx.tx->version != TRUC_VERSION) { | ||
| return util::Error{strprintf(_("Can't spend unconfirmed version %d pre-selected input with a version 3 tx"), parent_tx.tx->version)}; | ||
| } |
This PR Implements the following:
AvailableCoinsdoesn't return unconfirmed v2 utxos (and vice versa)AvailableCoinsdoesn't return an unconfirmed v3 utxo if its transaction already has a childcreaterawtransaction(uses commits from rpc: Support v3 raw transactions creation #31936)Closes #31348
To-Do:
createrawtransaction