Summary
This PR fixes issue #25980 where combinerawtransaction would silently accept unrelated transactions and only use the first one, ignoring the rest.
Problem
When passed two or more unrelated transactions (transactions with different inputs/outputs), combinerawtransaction would:
- Take the first transaction as the base
- Silently ignore the unrelated parts of subsequent transactions
- Only merge signatures for matching inputs
This behavior was confusing and could lead to unexpected results where users think they're combining transactions but actually only getting the first one back.
Solution
Added validation to ensure all transactions being combined are actually the same transaction (with potentially different signatures). The validation checks that all transactions have:
- The same number of inputs and outputs
- Identical input outpoints and sequences
- Identical output values and scripts
- The same version and locktime
If any transaction differs from the first, the RPC now throws a descriptive error indicating which transaction is unrelated.
Testing
Added test coverage in test/functional/rpc_rawtransaction.py that verifies:
- Unrelated transactions are properly rejected with an appropriate error message
- Related transactions (same transaction structure) can still be combined successfully
Fixes #25980