This is a first step toward a library of common factory functions for test and bench purposes.
This reduces duplication and supports writing tests by giving easier construction of the underlying types.
Previously open as #14892.
You may want to make this a "test_util" library instead of a "factory" library. That would clarify what this code is used for, make this a test-only change that should be easier to merge, and also create a home for other test code that could be reused.
29 | + return txSpend; 30 | +} 31 | + 32 | +CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CMutableTransaction& txCredit) 33 | +{ 34 | + return BuildSpendingTransaction(scriptSig, txCredit.vout[0].nValue, txCredit.GetHash());
Aware of the implicit precision losing conversion from long (CAmount) to int here? Should be made explicit or perhaps add an assertion for the allowed value range?
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, 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.
This is a first step toward a library of common factory functions for test and
bench purposes.