Skip to content

Conversation

@Roasbeef
Copy link
Member

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.

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.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 18023172931

Details

  • 0 of 27 (0.0%) changed or added relevant lines in 3 files are covered.
  • 19 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.08%) to 54.921%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server.go 0 1 0.0%
integration/rpctest/rpc_harness.go 0 6 0.0%
integration/rpctest/memwallet.go 0 20 0.0%
Files with Coverage Reduction New Missed Lines %
btcutil/gcs/gcs.go 1 81.25%
database/ffldb/blockio.go 4 88.81%
rpcclient/infrastructure.go 14 47.84%
Totals Coverage Status
Change from base Build 17994535365: 0.08%
Covered Lines: 31173
Relevant Lines: 56760

💛 - Coveralls

Copy link
Collaborator

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants