-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Support v3 raw transactions creation #31936
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
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/31936. 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. |
You'll have to add tests for any new feature and make sure the tests pass |
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.
Concept ACK. Thanks for your PR, but it needs to pass CI and new features need tests to be considered (please read CONTRIBUTING.md). Perhaps a functional test in rpc_rawtransaction.py.
src/rpc/rawtransaction_util.cpp
Outdated
if (!version.isNull()) { | ||
int64_t nVersion = version.getInt<int64_t>(); | ||
if (nVersion < 0 || nVersion > TRANSACTION_VERSION_MAX) | ||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, version out of range"); |
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.
Perhaps include what the min and max are.
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.
Added variable to denote min, max value of the version.
bitcoin/src/rpc/rawtransaction_util.cpp
Lines 159 to 160 in 1121cb7
if (nVersion < TX_MIN_STANDARD_VERSION || nVersion > TX_MAX_STANDARD_VERSION) | |
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, version out of range(1~3)"); |
src/script/script.h
Outdated
@@ -63,6 +63,9 @@ static constexpr int64_t VALIDATION_WEIGHT_PER_SIGOP_PASSED{50}; | |||
// How much weight budget is added to the witness size (Tapscript only, see BIP 342). | |||
static constexpr int64_t VALIDATION_WEIGHT_OFFSET{50}; | |||
|
|||
// Maximum transaction version | |||
static const int32_t TRANSACTION_VERSION_MAX = 3; |
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.
Why aren't we using TX_MAX_STANDARD_VERSION
everywhere?
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.
@glozow
Are you implying that we should use the variable instead of constant values in the test code?
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.
Yes, this seems to be redundant with TX_MAX_STANDARD_VERSION
. It also appears to be unused, did you maybe forget to delete it?
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.
removed it.
src/rpc/rawtransaction_util.cpp
Outdated
@@ -154,6 +154,13 @@ CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniVal | |||
rawTx.nLockTime = nLockTime; | |||
} | |||
|
|||
if (!version.isNull()) { | |||
int64_t nVersion = version.getInt<int64_t>(); |
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.
Why int64_t
? version
has type uint32_t
.
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.
@glozow
Thanks for the feedback. int64_t
was my bad. However version
field of raw transaction seems to be int32_t
type according to bitcoint developer doc.. The doc explicitly states that the field is signed. Should I used unsigned instead?
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's weird that it's signed, but I think we should use the same type as the docs
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.
Let's use uint32_t
because that is what is used in both CTransaction
and CMutableTransaction
.
bitcoin/src/primitives/transaction.h
Line 308 in 72c150d
const uint32_t version; |
bitcoin/src/primitives/transaction.h
Line 381 in 72c150d
uint32_t version; |
Those docs might be outdated because this change was done recently: #29325
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.
These docs are indeed outdated, last update was 4 years back: https://github.com/bitcoin-dot-org/developer.bitcoin.org. Only the code in this repo should be treated as source of truth.
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.
replaced it.
@@ -122,6 +122,7 @@ static const CRPCConvertParam vRPCConvertParams[] = | |||
{ "createrawtransaction", 1, "outputs" }, | |||
{ "createrawtransaction", 2, "locktime" }, | |||
{ "createrawtransaction", 3, "replaceable" }, | |||
{ "createrawtransaction", 4, "version" }, |
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.
Probably best not to have this be a positional parameter.
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.
@luke-jr
We had to add it because without it, RPC method vaildation does not pass.
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.
No, the issue isn't this one line of code, but the overall addition of the parameter
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.
I agree think it's a bit too important for a 4th positional arg
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.
@luke-jr @adamandrews1
So should I remove the line? If I should, could you advise which code should be updated to avoid failure of the aforementioned validation?
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.
I am inclining towards not adding a positional argument for this. Mostly because this is not something the user would use frequently and instead would let the defaults take over. I think using an optional options
object here (used in many RPCs) would suffice for this use case.
@glozow WDYT?
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.
Related, see #31936 (comment)
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 is needed as the arg is non-string type. My understanding is that @luke-jr is concept nacking the PR. I don't really understand the comments about the positionalness of this arg?
8a4348d
to
db71e16
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.
Thank you for working on this, please mention in the PR description that it closes the issue #31348.
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [], {}, 0, False, 2, 'foo') | ||
|
||
# Test `createrawtransaction` invalid version parameters | ||
assert_raises_rpc_error(-8, "Invalid parameter, version out of range(0~3)", self.nodes[0].createrawtransaction, [], {}, 0, False, -1) | ||
assert_raises_rpc_error(-8, "Invalid parameter, version out of range(0~3)", self.nodes[0].createrawtransaction, [], {}, 0, False, 4) |
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.
IMO we should add a test wherein a v3 transaction is successfully created, signed, and broadcast to the network. ATM, only the erroneous cases are covered.
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.
@rkrux
Utilized existing raw_multisig_transaction_legacy_tests
but with version 3 raw transaction. This seems to cover all the domain you specified. Could you pls take a look?
self.raw_multisig_transaction_legacy_tests(3) |
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.
See: #31936 (comment)
While updating the code, I noticed a couple of potential improvements.
|
Re: #31936 (comment)
This above point makes me realise that related to my previous comment #31936 (comment), we can add a more comprehensive functional test for raw transaction related RPCs in this PR that creates a v3 raw transaction |
An update to my previous comment: #31936 (comment) This can only done when PSBT V2 is implemented #21283, so no need for this at the moment. |
This comment was marked as abuse.
This comment was marked as abuse.
Concept ACK |
db71e16
to
1121cb7
Compare
src/rpc/rawtransaction_util.h
Outdated
@@ -54,5 +54,6 @@ void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in); | |||
|
|||
/** Create a transaction from univalue parameters */ | |||
CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniValue& outputs_in, const UniValue& locktime, std::optional<bool> rbf); |
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.
not sure about default args. It would be better to explicitly enumerate the call sites and just put the default there, if needed.
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.
Is this comment outdated? I don't understand where are the default args here that are referred to in the above comment.
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.
Is this comment outdated? I don't understand where are the default args here that are referred to in the above comment.
In C++, function overloading can be used as a tool to set default values for function parameters. This is done here, by setting the default value in the function implementation, as opposed to in the function signature.
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.
Oh I see this comment referred to the new implementation of this older function caused by the introduction of function overloading here. Yeah, I am not in favour of this as well, seem unnecessary for just a version
param, the function signature defaults can suffice.
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.
I was trying to say in #31936 (comment) that a default doesn't make sense at all here (in any way), because:
- Every call site that omits the default has the same fallback, so changing the default in the future will make review harder.
- Every call site needs to document the default in the RPC help anyway, so simply using the default from the docs is self-consistent and self-documenting and avoids the need for a default here
Finally, default values in C++ function signatures or function overloads are problematic, when more defaults are added in the future, because there is no way to skip over one default value and only specify the other one. Modern languages, such as Rust don't support this at all, or Python allows for named args.
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.
Interesting, I like these points quite a lot. Summarising below, please correct me if I misunderstand:
We can avoid using defaults here completely by letting the corresponding version
default trickle down from the RPC help into these functions here.
As I checked in the call sites of CreateTransaction
, this^ requires other transaction creation RPCs to accept a version param as well such as createpsbt
, walletcreatefundedpsbt
, send
, sendall
, which seems consistent with an earlier suggestion here #31936 (comment).
This increases the scope of the PR a bit but I feel it's worth doing these changes as these RPCs are quite related to each other in terms of functionality. I can correspondingly update the issue description as well.
This also helps to make a case for using the options
argument in a previously open ended question here #31936 (comment) because most of the above mentioned RPCs accept an option
param wherein the version
option can be added.
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 is truly amazing content. I wrote a blog post on this topic.
@@ -122,6 +122,7 @@ static const CRPCConvertParam vRPCConvertParams[] = | |||
{ "createrawtransaction", 1, "outputs" }, | |||
{ "createrawtransaction", 2, "locktime" }, | |||
{ "createrawtransaction", 3, "replaceable" }, | |||
{ "createrawtransaction", 4, "version" }, |
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.
I am inclining towards not adding a positional argument for this. Mostly because this is not something the user would use frequently and instead would let the defaults take over. I think using an optional options
object here (used in many RPCs) would suffice for this use case.
@glozow WDYT?
src/rpc/rawtransaction_util.cpp
Outdated
@@ -154,6 +154,13 @@ CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniVal | |||
rawTx.nLockTime = nLockTime; | |||
} | |||
|
|||
if (!version.isNull()) { | |||
int64_t nVersion = version.getInt<int64_t>(); |
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.
Let's use uint32_t
because that is what is used in both CTransaction
and CMutableTransaction
.
bitcoin/src/primitives/transaction.h
Line 308 in 72c150d
const uint32_t version; |
bitcoin/src/primitives/transaction.h
Line 381 in 72c150d
uint32_t version; |
Those docs might be outdated because this change was done recently: #29325
@@ -491,7 +496,7 @@ def transaction_version_number_tests(self): | |||
decrawtx = self.nodes[0].decoderawtransaction(rawtx) | |||
assert_equal(decrawtx['version'], 0xffffffff) | |||
|
|||
def raw_multisig_transaction_legacy_tests(self): | |||
def raw_multisig_transaction_legacy_tests(self, version=2): |
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.
Although this works but there seems to be a note here regarding legacy wallets, which are being deprecated. I think a more suitable place could be in the getrawtransaction_verbosity_tests
that use create_self_transfer()
, which already accepts a version argument in the tests - just need to pass down 3.
Also, testing the value of the transaction version after being mined would complete the all-round testing of this functionality for which only adding a new field
for version in the getrawtransaction_verbosity_tests
subtest should suffice here:
bitcoin/test/functional/rpc_rawtransaction.py
Line 187 in 199d47d
fields = [ |
@@ -180,6 +181,7 @@ static const CRPCConvertParam vRPCConvertParams[] = | |||
{ "createpsbt", 1, "outputs" }, | |||
{ "createpsbt", 2, "locktime" }, | |||
{ "createpsbt", 3, "replaceable" }, | |||
{ "createpsbt", 4, "version" }, |
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.
If accepting a new argument can't be avoided for this PSBT RPC because of the same CreateTxDoc()
being reused underneath, then I think we can explore updating functional tests for PSBT in this PR itself because createpsbt
RPC uses the same ConstructTransaction()
as well.
rpc_psbt.py
is the file that would need to be updated. Using a similar approach like done in the rpc_rawtransaction
would be preferred that is reusing bunch of the existing testing methods.
src/rpc/rawtransaction_util.h
Outdated
@@ -54,5 +54,6 @@ void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in); | |||
|
|||
/** Create a transaction from univalue parameters */ | |||
CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniValue& outputs_in, const UniValue& locktime, std::optional<bool> rbf); |
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.
Is this comment outdated? I don't understand where are the default args here that are referred to in the above comment.
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.
Answering open comments.
src/rpc/rawtransaction_util.h
Outdated
@@ -54,5 +54,6 @@ void AddOutputs(CMutableTransaction& rawTx, const UniValue& outputs_in); | |||
|
|||
/** Create a transaction from univalue parameters */ | |||
CMutableTransaction ConstructTransaction(const UniValue& inputs_in, const UniValue& outputs_in, const UniValue& locktime, std::optional<bool> rbf); |
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.
Interesting, I like these points quite a lot. Summarising below, please correct me if I misunderstand:
We can avoid using defaults here completely by letting the corresponding version
default trickle down from the RPC help into these functions here.
As I checked in the call sites of CreateTransaction
, this^ requires other transaction creation RPCs to accept a version param as well such as createpsbt
, walletcreatefundedpsbt
, send
, sendall
, which seems consistent with an earlier suggestion here #31936 (comment).
This increases the scope of the PR a bit but I feel it's worth doing these changes as these RPCs are quite related to each other in terms of functionality. I can correspondingly update the issue description as well.
This also helps to make a case for using the options
argument in a previously open ended question here #31936 (comment) because most of the above mentioned RPCs accept an option
param wherein the version
option can be added.
Are you still working on this? |
sure! |
src/script/script.h
Outdated
@@ -63,6 +63,9 @@ static constexpr int64_t VALIDATION_WEIGHT_PER_SIGOP_PASSED{50}; | |||
// How much weight budget is added to the witness size (Tapscript only, see BIP 342). | |||
static constexpr int64_t VALIDATION_WEIGHT_OFFSET{50}; | |||
|
|||
// Maximum transaction version | |||
static const int32_t TRANSACTION_VERSION_MAX = 3; |
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.
Yes, this seems to be redundant with TX_MAX_STANDARD_VERSION
. It also appears to be unused, did you maybe forget to delete it?
@@ -144,6 +144,7 @@ std::vector<uint32_t> GetDust(const CTransaction& tx, CFeeRate dust_relay_rate); | |||
// Changing the default transaction version requires a two step process: first | |||
// adapting relay policy by bumping TX_MAX_STANDARD_VERSION, and then later | |||
// allowing the new transaction version in the wallet/RPC. | |||
static constexpr decltype(CTransaction::version) TX_MIN_STANDARD_VERSION{1}; |
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.
concept ack introducing this constant. I think it would be best to have it in a separate commit and replace the magic number in policy.cpp with this
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.
I'm not sure about the meaning of 'separate commit,' but I replaced the magic number in the policy.cpp file with a constant value.
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.
I mean putting the changes assigning 1 to this constant in one commit, and then the version parameter addition in a second commit.
src/rpc/rawtransaction.cpp
Outdated
@@ -158,6 +158,7 @@ static std::vector<RPCArg> CreateTxDoc() | |||
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"}, | |||
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{true}, "Marks this transaction as BIP125-replaceable.\n" | |||
"Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."}, | |||
{"version", RPCArg::Type::NUM, RPCArg::Default{2}, "Transaction version"}, |
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.
Should use CURRENT_VERSION
instead of magic number
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.
Fix it.
@@ -122,6 +122,7 @@ static const CRPCConvertParam vRPCConvertParams[] = | |||
{ "createrawtransaction", 1, "outputs" }, | |||
{ "createrawtransaction", 2, "locktime" }, | |||
{ "createrawtransaction", 3, "replaceable" }, | |||
{ "createrawtransaction", 4, "version" }, |
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 is needed as the arg is non-string type. My understanding is that @luke-jr is concept nacking the PR. I don't really understand the comments about the positionalness of this arg?
1121cb7
to
3722e10
Compare
Added support for creating v3 raw transaction: - Overloaded to include additional parameter 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>
d3e3ea7
to
a43237d
Compare
@luke-jr @instagibbs @maflcko @rkrux @glozow @adamandrews1 @w0xlt @1440000bytes |
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 63d9b9e
Suggested some improvements, but not blocking ones IMO
src/rpc/rawtransaction_util.cpp
Outdated
if (!version.isNull()) { | ||
uint32_t nVersion = version.getInt<uint32_t>(); | ||
if (nVersion < TX_MIN_STANDARD_VERSION || nVersion > TX_MAX_STANDARD_VERSION) | ||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, version out of range(1~3)"); |
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 RPC error should be a formatted string so that it remains accurate as TX_MIN_STANDARD_VERSION
and TX_MAX_STANDARD_VERSION
get updated.
|
||
# Test `createrawtransaction` invalid version parameters | ||
assert_raises_rpc_error(-8, "Invalid parameter, version out of range(1~3)", self.nodes[0].createrawtransaction, [], {}, 0, False, 0) | ||
assert_raises_rpc_error(-8, "Invalid parameter, version out of range(1~3)", self.nodes[0].createrawtransaction, [], {}, 0, False, 4) |
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.
The final parameter (tx version) for this test should be set to TX_MAX_STANDARD_VERSION + 1
or at least to a number with headroom like 999
.
rawtx_v3 = self.nodes[2].createrawtransaction(inputs=[{'txid': TXID, 'vout': 9}], outputs=OrderedDict([(address, 99), (address2, 99)]), version=3) | ||
tx = tx_from_hex(rawtx_v3) | ||
assert_equal(tx.version, 3) |
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.
Shouldn't this test be repeated for each valid tx.version
in the range [TX_MIN_STANDARD_VERSION, TX_MAX_STANDARD_VERSION]
?
Approach NACK While I agree that we should support v3 transactions, I think this implementation is incomplete without any v3 support in the wallet's coin selection. As it is now, this appears to enable a massive footgun - users can use I expect that supporting sending v3 transactions from Bitcoin Core will actual be a significantly more involved project. While I appreciate your enthusiasm, I think it would be better to leave the implementation of this feature to experienced contributors. |
@adamandrews1 @achow101 P.S. We’ve incorporated all code review feedback. Please review when convenient. |
🚧 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. |
Though, CI is failing on this pull. |
|
I don't think
The following |
ref #32896 |
Not sure what you are asking for. Feedback has been provided, and the burden to address it and reply to it is on the pull request author. I can't make it go away by looking at it more. Apart from the prior feedback, you'd also have to squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits into atomic units (https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#committing-patches) |
Closing for now, due to inactivity. The given feedback hasn't bee addressed over a long time and at this point it may be best to focus review on #32896. |
…port 5c8bf7b doc: add release notes for version 3 transactions (ishaanam) 4ef8065 test: add truc wallet tests (ishaanam) 5d932e1 test: extract `bulk_vout` from `bulk_tx` so it can be used by wallet tests (ishaanam) 2cb473d rpc: Support version 3 transaction creation (Bue-von-hon) 4c20343 rpc: Add transaction min standard version parameter (Bue-von-hon) c5a2d08 wallet: don't return utxos from multiple truc txs in AvailableCoins (ishaanam) da8748a wallet: limit v3 tx weight in coin selection (ishaanam) 85c5410 wallet: mark unconfirmed v3 siblings as mempool conflicts (ishaanam) 0804fc3 wallet: throw error at conflicting tx versions in pre-selected inputs (ishaanam) cc15522 wallet: set m_version in coin control to default value (ishaanam) 2e96176 wallet: don't include unconfirmed v3 txs with children in available coins (ishaanam) ec2676b wallet: unconfirmed ancestors and descendants are always truc (ishaanam) Pull request description: This PR Implements the following: - If creating a v3 transaction, `AvailableCoins` doesn't return unconfirmed v2 utxos (and vice versa) - `AvailableCoins` doesn't return an unconfirmed v3 utxo if its transaction already has a child - If a v3 transaction is kicked out of the mempool by a sibling, mark the sibling as a mempool conflict - Throw an error if pre-selected inputs are of the wrong transaction version - Allow setting version to 3 manually in `createrawtransaction` (uses commits from #31936) - Limits a v3 transaction weight in coin selection Closes #31348 To-Do: - [x] Test a v3 sibling conflict kicking out one of our transactions from the mempool - [x] Implement separate size limit for TRUC children - [x] Test that we can't fund a v2 transaction when everything is v3 unconfirmed - [x] Test a v3 sibling conflict being removed from the mempool - [x] Test limiting v3 transaction weight in coin selection - [x] Simplify tests - [x] Add documentation - [x] Test that user-input max weight is not overwritten by truc max weight - [x] Test v3 in RPCs other than `createrawtransaction` ACKs for top commit: glozow: reACK 5c8bf7b achow101: ACK 5c8bf7b rkrux: ACK 5c8bf7b Tree-SHA512: da8aea51c113e193dd0b442eff765bd6b8dc0e5066272d3e52190a223c903f48788795f32c554f268af0d2607b5b8c3985c648879cb176c65540837c05d0abb5
Added support for creating v3 raw transaction:
this resolves #31348