Part of the effort discussed in #35994: replace procedural, field-by-field construction of COutPoint, CTxIn and CTxOut in test code with constructor calls.
This PR covers cases that are context-dependent and need manual changes, independent of a scripted-diff for the trivial bulk:
test/util/transaction_utils: inBuildSpendingTransaction, thescriptWitnessassignment has to be moved aftervinis replaced, otherwise the witness is dropped.test/util/mining: inCreateBlockChain, the coinbase input's fields were split by the output assignments, with comments that are now kept next to the constructor arguments.sigopcount_tests:BuildTxshas the same witness ordering issue asBuildSpendingTransaction.bench/ccoins_caching: ThescriptSigs are built with<<appends, and the second output was created byvout.resize(2)but never assigned, so it is kept as a nullCTxOut{}.transaction_tests:test_Getbuilds the same transaction asbench/ccoins_caching, with the same<<appends and null second output.
This change is test- and bench-only and does not change the constructed transactions.
Notes for reviewers:
CTxInhas no witness constructor argument, soscriptWitnessis assigned aftervinis replaced.BuildTxsis called repeatedly on the same transaction objects. Previously,resize(1)kept the existing inputs and only overwrote some of their fields; now they are replaced entirely. The fields that were left untouched byBuildTxsare never modified by the test, so the transactions are unchanged.- The null second output in
ccoins_cachingis copied fromtest_Getintransaction_testsand looks like an oversight. It is kept here to avoid behaviour changes.