HomePhabricator

Make CTransaction construction from CMutableTransaction explicit

Description

Make CTransaction construction from CMutableTransaction explicit

Summary:
Most of the changes are in the test code. The tests first build CMutableTransaction and then used t implicit conversion to call functions that require CTransaction.

I decided to use CTransaction(x) for conversion. Let me know if you prefer static_cast<CTransaction>.

In many cases, I was tempted to create an overload that takes a CTransaction (for example for IsStandardTx(), that is heavily used in transaction_tests.cpp), but later decided to use explicit conversion, otherwise the result will be very similar to using implicit cast operator, that I was trying to get rid of. An alternative solution would be to create a IsStandardTxFromMutable(), that would be local to test code.

I had quite some fun with test combineSigs, because I’ve overlooked the fact that it modifies transaction by directly manipulating references to CMutableTransaction’s members.

Refs T238

Test Plan:
make check
./test/functional/test_runner.py

Reviewers: schancel, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: schancel, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: teamcity

Maniphest Tasks: T238

Differential Revision: https://reviews.bitcoinabc.org/D1106

Details

Provenance
matra774Authored on Feb 17 2018, 23:39
matra774Pushed on Feb 18 2018, 00:07
Reviewer
Restricted Owners Package
Differential Revision
D1106: Make CTransaction construction from CMutableTransaction explicit
Parents
rABCc598044ef05f: Ensure missing test warning fails on CI.
Branches
Unknown
Tags
Unknown