-
Notifications
You must be signed in to change notification settings - Fork 2.5k
multi: make v3 transaction standard (no TRUC impl yet) #2432
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
Open
Roasbeef
wants to merge
5
commits into
btcsuite:master
Choose a base branch
from
Roasbeef:v3-tx-standard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+391
−16
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces the MaxStandardTxVersion constant to the mempool policy package, setting it to 3 to enable support for version 3 transactions. Previously, the maximum accepted transaction version was hardcoded to 2 in the server configuration. Note that we don't yet implement the new TRUC rules, yet. But this'll enable acceptance into the btcd mempool.
In this commit, we replace the hardcoded transaction version limit of 2 with the MaxStandardTxVersion constant from the mempool package. This change ensures the server configuration stays synchronized with the mempool policy definition and enables v3 transaction support throughout the system.
In this commit, we introduce a functional options pattern to the test memwallet, allowing tests to specify custom transaction versions when creating transactions. This enhancement provides the test infrastructure needed to validate v3 transaction handling throughout the system. All transaction creation methods (CreateTransaction, SendOutputs, and SendOutputsWithoutChange) now accept variadic options while maintaining backward compatibility - existing tests continue to work unchanged as the default behavior remains version 1 transactions.
In this commit, we extend the mempool policy test suite to explicitly verify that version 2 and version 3 transactions are accepted as standard. The test now uses the MaxStandardTxVersion constant rather than a hardcoded value, ensuring the tests stay synchronized with the actual policy implementation. We added specific test cases for v2 and v3 transactions to document and verify the expected behavior, confirming that transactions with these versions pass the standardness checks. The test for excessive version numbers was also updated to use MaxStandardTxVersion + 1, making it clear that we're testing the rejection of versions beyond our current policy limit.
In this commit, we introduce a comprehensive integration test suite that validates v3 transaction handling across the full stack, from mempool acceptance through mining into blocks. These tests ensure that v3 transactions work correctly in real-world scenarios using the RPC test harness. The test suite covers multiple critical scenarios to ensure robust v3 transaction support. TestV3TransactionPolicy validates that transactions with versions 1, 2, and 3 are accepted while version 4 is properly rejected, confirming our policy enforcement works as intended. The test also verifies that accepted v3 transactions can be successfully mined into blocks, demonstrating end-to-end functionality. TestV3TransactionRPCSubmission specifically tests the RPC pathway, ensuring that v3 transactions created with the WithTxVersion option can be submitted through SendOutputs and properly confirmed in blocks. This validates that the functional options we added to the test infrastructure work correctly in practice. TestV3TransactionChaining goes further by testing that outputs from v3 transactions can be spent by subsequent transactions, confirming that the UTXO management and transaction validation logic properly handles the new version throughout the transaction lifecycle.
Pull Request Test Coverage Report for Build 18023172931Details
💛 - Coveralls |
sputn1ck
approved these changes
Sep 30, 2025
Collaborator
sputn1ck
left a 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.
LGTM!
kmk142789
approved these changes
Nov 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this commit, we make a series of changes to make v3 transactions standard. This means that we'll relay, then and accept them into our mempool. This PR doesn't yet implement the new TRUC semantics yet.