Skip to content

CTransaction: Add constructor taking inputs and outputs - #36696

Open
purpleKarrot wants to merge 3 commits into
bitcoin:masterfrom
purpleKarrot:declarative-test-data
Open

purpleKarrot wants to merge 3 commits into
bitcoin:masterfrom
purpleKarrot:declarative-test-data

Conversation

@purpleKarrot

@purpleKarrot purpleKarrot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Part of #36692. Please view this PR in context of changes like #36694.

CTransaction gains a constructor that allows direct declarative construction as an alternative to building through CMutableTransaction. CTxIn's constructors gain an optional argument to pass the script witness.

@DrahtBot

DrahtBot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK hodlinator, janb84, yuvicc, alexanderwiederin, optout21
Concept ACK sedited

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

Comment thread src/primitives/transaction.h Resolved

@alexanderwiederin alexanderwiederin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The CTxIn witness argument is a nice addition. It would remove the “assign the witness after replacing vin” workaround I needed in several places in #36606 and #36694.

Comment thread src/util/vector.h Resolved
Comment thread src/primitives/transaction.h Resolved
@purpleKarrot
purpleKarrot force-pushed the declarative-test-data branch from 4491755 to 705d5d5 Compare October 30, 2026 07:17
@purpleKarrot

purpleKarrot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

I have replaced the commits that exemplify the constructor in action with one that shows multiple things in a single place:

  • It shows the new constructor of CTransaction in action.
  • It shows the new constructor of CTxIn in action.
  • It shows how CMutableTransaction is not necessary in many places, not just for building, but also as function argument.
  • It reveals GetTxSigOpCost as an example test that contains multiple blocks where each should become its own unit test.
  • It reveals potential test dependencies: Each test setup modifies the CCoinsViewCache. It is not clear whether a test might depend on the modifications of tests run earlier or not.
  • It shows that CTransaction could benefit from applying best practices (never use const data members, maintain immutability by not providing write access): In return {std::move(creationTx), std::move(spendingTx)};, the compiler provided move constructor of CTransaction invokes the move constructors of all its data members, which are const, so they fall back to copying (this does not fire performance-move-const-arg, because the individual data members fall back, not the tx object).
  • It reveals the annoyance that CTransaction does not provide regular semantics: It is not possible to replace the existing values with std::tie(creationTx, spendingTx) = BuildTxs(...);, because CTransaction is only sort-of copyable (due to not following ... I repeat myself. This is not a big deal here, as tests should be refactored for independence anyway).
  • It also provides an example where code could be much less verbose if the constructor accepted std::vector and explicit types were not required at the call site, and why I claim this to be less readable:
CTransaction creationTx{{{{}}}, {{1, scriptPubKey}}, 1};
CTransaction spendingTx{{{{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}}, {{1, {}}}, 1};

@sedited

sedited commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Concept ACK

Comment thread src/test/sigopcount_tests.cpp Resolved
fanquake added a commit that referenced this pull request Nov 5, 2026
…vely

c723c37 test: construct multisig_tests inputs/outputs declaratively (yuvicc)

Pull request description:

  Part of #36692. This replaces the field-by-field construction of transaction inputs and outputs in `multisig_tests` with `COutPoint`, `CTxIn` and `CTxOut` constructor calls.

  It keeps `CMutableTransaction` as the builder, since a `CTransaction` constructor taking inputs and outputs directly is still under discussion (#36696). If one is added, the `vin`/`vout` lists here can be passed to it directly.

  This change is test-only and does not change the constructed transactions:

  - The funding outputs were previously created by `vout.resize(3)` and only had their `scriptPubKey` assigned, leaving `nValue` at its null value (`-1`). The `-1` is now spelled out explicitly, which makes this previously hidden value visible
  - The loop index is changed from `int` to `uint32_t` to match `COutPoint::n`

ACKs for top commit:
  purpleKarrot:
    ACK c723c37
  maflcko:
    review ACK c723c37 🍯
  alexanderwiederin:
    ACK c723c37

Tree-SHA512: 3122762dae1e4fbc1a4ad79ce67128e83d29da965b3c8b6009f075c39310b8f983a96e3c4f30844a57af2faca4c658149808176aa4bb67d940ebeec147031676
@purpleKarrot
purpleKarrot force-pushed the declarative-test-data branch from 705d5d5 to 06c8215 Compare November 6, 2026 09:38
sedited added a commit that referenced this pull request Nov 6, 2026
…ively

b7abd88 test: construct mempool_tests inputs/outputs declaratively (Alexander Wiederin)

Pull request description:

  Part of #36692. This replaces the field-by-field construction of transaction inputs and outputs in `mempool_tests` with `COutPoint`, `CTxIn` and `CTxOut` constructor calls.

  It keeps `CMutableTransaction` as the builder, since a `CTransaction` constructor taking inputs and outputs directly is still under discussion (#36696). If one is added, the `vin`/`vout` lists here can be passed to it directly. Either way, the declarative form makes the constructed transactions easier to read.

  This change is test-only and does not change the constructed transactions.

  The `mempool_eviction` bench and `rbf_tests` changes from the earlier version of this PR have been dropped, as they conflict with #36521. They can follow once that is resolved.

ACKs for top commit:
  sedited:
    ACK b7abd88
  yuvicc:
    lgtm ACK b7abd88
  janb84:
    tACK b7abd88

Tree-SHA512: 5d1ebdad6d5029a310434415cb0bcbe0bdaddfcee0fd3381eb03b9189a851187e302e794e74b81b7bb193ab14425a40dd531f0eea14baf774171fc168748eec5
sedited added a commit that referenced this pull request Nov 8, 2026
…txpackage, duplicate_inputs and p2sh tests

a4a2647 test: construct script_p2sh_tests inputs/outputs declaratively (yuvicc)
7fc7d26 bench: construct duplicate_inputs inputs/outputs declaratively (yuvicc)
5336eaa test: construct txpackage_tests inputs/outputs declaratively (yuvicc)

Pull request description:

  Part of #36692. Follow-up to #36750

  Replaces field-by-field construction of inputs and outputs with `COutPoint`, `CTxIn` and `CTxOut` ctor calls in `txpackage_tests`, `bench/duplicate_inputs` and `script_p2sh_tests`.

  `CMutableTransaction` is kept as the builder while a `CTransaction` constructor is discussed in #36696. Witnesses are still assigned after `vin`, since `CTxIn` has no witness argument yet.

  Test-only; the constructed transactions are unchanged.

  - `script_p2sh_tests`: two outputs created by `vout.resize(1)` never had a value, so their null `nValue` (`-1`) is now explicit.
  - Intentional mutations are left as they are: the `scriptSig` swap in `sign`, the dummy signing in `ValidateInputsStandardness`, and the witness-only copies in `txpackage_tests` (`mtx_child2`, `mtx_parent2_v2`).

ACKs for top commit:
  alexanderwiederin:
    ACK a4a2647
  purpleKarrot:
    ACK a4a2647
  maflcko:
    review ACK a4a2647 👒
  janb84:
    ACK a4a2647
  jpk68:
    ACK a4a2647

Tree-SHA512: ca452697a5bcccfbed2778785906f75c22e95fea04a1e79fb2d6fdae80ebe4badf5d8cb49a8b6add6e80a480b4826436caaee43ec534d4e6aae22f6584935b86
Comment thread src/primitives/transaction.h Resolved
Comment thread src/primitives/transaction.h Resolved
@yuvicc

yuvicc commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Concept ACK

@alexanderwiederin alexanderwiederin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR description still says that elements are copied or moved, while it has been changed to always copy.

nit: commit messages could use a short body with motivation of #36692

Comment thread src/util/vector.h Resolved

@janb84 janb84 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept ACK

After going back and forward on this PR, I have to agree with @maflcko and prefer the by-value std::vector constructor as the public interface.

If i'm correct the braced lists are the common case in the tests which this constructor is meant to clean up. A range template can't take those, so every such call site would still need a std::array wrapper.

On the txpackage_tests example: as written it doesn't compile against this PR. CTxIn(COutPoint) is explicit, so a range of COutPoint doesn't satisfy RangeOf, and package has to stay a real Package because the test shuffles it and appends the child.

So if i fix the example, the two versions are:

// range constructor
const CTransaction child{
    package | std::views::transform([](const CTransactionRef& parent) { return CTxIn{COutPoint{parent->GetHash(), 0}}; }),
    std::array{CTxOut{47 * COIN, spk2}}, // a braced list doesn't compile next to a view
};

// vector constructor
std::vector<CTxIn> inputs;
for (const auto& parent : package) inputs.emplace_back(COutPoint{parent->GetHash(), 0});
const CTransaction child{std::move(inputs), {CTxOut{47 * COIN, spk2}}};

So the range version saves one line in C++20, and nothing once std::ranges::to is available. And in the corrected version the readability diff is weak imho.

My strong preference currently (if I have not missed a angle) is to land the by-value vector constructor here and add the range overload as a follow-up once there's a real view-shaped caller that needs it.

@purpleKarrot
purpleKarrot force-pushed the declarative-test-data branch 2 times, most recently from ac38485 to 92f366a Compare November 24, 2026 19:41
@purpleKarrot

Copy link
Copy Markdown
Contributor Author

Changed constructors to take the types of the corresponding members by value and move into place.
I agree that this is the most straightforward approach.

@janb84 janb84 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for changing it to a by-value vector constructor.
Below are some NIT fixes that are also suggested by Ralph.

Comment thread src/test/sigopcount_tests.cpp Outdated
Comment on lines +88 to +100
auto creationTx = CTransaction{
std::vector{CTxIn{COutPoint{}}},
std::vector{CTxOut{1, scriptPubKey}},
/*version=*/ 1,
};
creationTx.vout = {
CTxOut{1, scriptPubKey},
auto spendingTx = CTransaction{
std::vector{CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}},
std::vector{CTxOut{1, CScript{}}},
/*version=*/ 1,
};

spendingTx.version = 1;
spendingTx.vin = {
CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig},
};
spendingTx.vin[0].scriptWitness = witness;
spendingTx.vout = {
CTxOut{1, CScript{}},
};

AddCoins(coins, CTransaction(creationTx), 0);
AddCoins(coins, creationTx, /*nHeight=*/ 0);
return {std::move(creationTx), std::move(spendingTx)};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: With the change to a vector constructor, this can be simplified.

Suggested change
auto creationTx = CTransaction{
std::vector{CTxIn{COutPoint{}}},
std::vector{CTxOut{1, scriptPubKey}},
/*version=*/ 1,
};
creationTx.vout = {
CTxOut{1, scriptPubKey},
auto spendingTx = CTransaction{
std::vector{CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}},
std::vector{CTxOut{1, CScript{}}},
/*version=*/ 1,
};
spendingTx.version = 1;
spendingTx.vin = {
CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig},
};
spendingTx.vin[0].scriptWitness = witness;
spendingTx.vout = {
CTxOut{1, CScript{}},
};
AddCoins(coins, CTransaction(creationTx), 0);
AddCoins(coins, creationTx, /*nHeight=*/ 0);
return {std::move(creationTx), std::move(spendingTx)};
const CTransaction creationTx{
{CTxIn{COutPoint{}}},
{CTxOut{1, scriptPubKey}},
/*version=*/ 1,
};
const CTransaction spendingTx{
{CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}},
{CTxOut{1, CScript{}}},
/*version=*/ 1,
};
AddCoins(coins, creationTx, /*nHeight=*/ 0);
return {creationTx, spendingTx};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How far do we want to go? just drop the explicit std::vector or also CTxIn, COutPoint, etc?

    auto creationTx = CTransaction{
        /*inputs=*/ {{{}}},
        /*outputs=*/ {{1, scriptPubKey}},
        /*version=*/ 1,
    };

I would rather keep them all.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How far do we want to go?

Well i'm only suggesting to remove the explicit vector and make them const. Happy to drop the const but wondering what keeping the explicit std::vector is providing us?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Making the local variables const would cause them to be copied in the return statement.
Keeping std::vector is just for consistency, so you don't have to decide where to put a type in front of a brace and where you can omit it. Just consistently use a type always. Hence auto with the type on the right. But it is my personal preference. I can also change it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given the future context of making the const members private it is more logical to keep the moves indeed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For some reason I also prefer omitting the explicit std::vector, it's a beloved but boring type, making the initializer-list braces feel sufficient. But agree it's subjective.

Comment on lines 165 to +171
scriptPubKey[0] = 0x00;
BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
const auto [creationTx3, spendingTx3] = BuildTxs(coins, scriptPubKey, scriptSig, scriptWitness);

// The witness of a coinbase transaction is not taken into account.
spendingTx.vin[0].prevout.SetNull();
assert(GetTransactionSigOpCost(CTransaction(spendingTx), coins, flags) == 0);
CMutableTransaction spendingTx4{spendingTx3};
spendingTx4.vin[0].prevout.SetNull();
assert(GetTransactionSigOpCost(CTransaction{spendingTx4}, coins, flags) == 0);

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

re-use the spendingTx instead of creating a new spendingTx

This goes against the motivation of making unit tests not depend on modifications of other tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fair enough. My thinking was that spendingTx is now an immutable value and it's in the same block so not really an other test. Lets keep it as is.

@janb84 janb84 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 92f366a

Happy with the current state of this PR, (see discussions above). I think it is in a good state and shows enough value to get merged.

@DrahtBot
DrahtBot requested a review from sedited November 25, 2026 12:47
@alexanderwiederin

Copy link
Copy Markdown
Contributor

ACK 92f366a

Built test_bitcoin and ran sigopcount_tests and transaction_tests locally.

Non-blocking nit: consider making the constructor explicit, to match the CMutableTransaction constructors. That would stop things like f({vin, vout}) from quietly building and hashing a transaction.

I plan to open follow-ups that convert more tests from CMutableTransaction to constructing CTransaction directly.

@hodlinator hodlinator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 92f366a

Nice use of forwarding constructors.
Good choice of unit test to clean up!
Happy you switched to accepting movable std::vectors for now.

Some subjective divergence in style, most prominent being the one clang-format agrees with me on (see inline comment).

Comment thread src/primitives/transaction.h Resolved
Comment thread src/test/sigopcount_tests.cpp Outdated
Comment on lines +88 to +100
auto creationTx = CTransaction{
std::vector{CTxIn{COutPoint{}}},
std::vector{CTxOut{1, scriptPubKey}},
/*version=*/ 1,
};
creationTx.vout = {
CTxOut{1, scriptPubKey},
auto spendingTx = CTransaction{
std::vector{CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}},
std::vector{CTxOut{1, CScript{}}},
/*version=*/ 1,
};

spendingTx.version = 1;
spendingTx.vin = {
CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig},
};
spendingTx.vin[0].scriptWitness = witness;
spendingTx.vout = {
CTxOut{1, CScript{}},
};

AddCoins(coins, CTransaction(creationTx), 0);
AddCoins(coins, creationTx, /*nHeight=*/ 0);
return {std::move(creationTx), std::move(spendingTx)};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For some reason I also prefer omitting the explicit std::vector, it's a beloved but boring type, making the initializer-list braces feel sufficient. But agree it's subjective.

Comment thread src/test/sigopcount_tests.cpp Resolved
Comment thread src/test/sigopcount_tests.cpp Resolved
@purpleKarrot
purpleKarrot force-pushed the declarative-test-data branch from 92f366a to e63704e Compare December 1, 2026 07:36
@purpleKarrot

Copy link
Copy Markdown
Contributor Author

Keeping std::vector is just for consistency, so you don't have to decide where to put a type in front of a brace and where you can omit it. Just consistently use a type always. Hence auto with the type on the right. But it is my personal preference. I can also change it. #36696 (comment)

It is still my preference to always have the type in front of the brace. But, meh. Changed the code to @hodlinator's preference.

@purpleKarrot
purpleKarrot force-pushed the declarative-test-data branch from e63704e to 3ffffa0 Compare December 1, 2026 07:45

@hodlinator hodlinator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

re-ACK 3ffffa0

Thanks for incorporating my suggestions. Also resolves conflict with merged #36895.

CTransaction creationTx{
/*inputs=*/{CTxIn{COutPoint{}}},
/*outputs=*/{CTxOut{1, scriptPubKey}},
/*version=*/1,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nanonits, feel free to ignore:

  • CTxIn and CTxOut already indicate inputs/outputs, so the comments seems slightly redundant.
  • Could also remove redundant COutPoint{}.
--- a/src/test/sigopcount_tests.cpp
+++ b/src/test/sigopcount_tests.cpp
@@ -86,13 +86,13 @@ static ScriptError VerifyWithFlag(const CTransaction& output, const CTransaction
 static std::pair<CTransaction, CTransaction> BuildTxs(CCoinsViewCache& coins, const CScript& scriptPubKey, const CScript& scriptSig, const CScriptWitness& witness)
 {
     CTransaction creationTx{
-        /*inputs=*/{CTxIn{COutPoint{}}},
-        /*outputs=*/{CTxOut{1, scriptPubKey}},
+        {CTxIn{}},
+        {CTxOut{1, scriptPubKey}},
         /*version=*/1,
     };
     CTransaction spendingTx{
-        /*inputs=*/{CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}},
-        /*outputs=*/{CTxOut{1, CScript{}}},
+        {CTxIn{COutPoint{creationTx.GetHash(), 0}, scriptSig, CTxIn::SEQUENCE_FINAL, witness}},
+        {CTxOut{1, CScript{}}},
         /*version=*/1,
     };
 

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would opt to keep it.

@janb84 janb84 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

re-ACK 3ffffa0

changes sinds last ACK;

  • small style changes

@yuvicc

yuvicc commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

cr-ACK 3ffffa0

The value ctor for CTransaction and the scriptWitness parameter on CTxIn are small additions that don't change behaviour, and the existing CMutableTransaction ctors now delegate to the new one. The test shows the benefits as well.

@alexanderwiederin

Copy link
Copy Markdown
Contributor

ACK 3ffffa0

@optout21 optout21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 3ffffa0

New CTransaction constructor created for tests, but it's useful in general. Left some minor comments.

scriptPubKey[0] = 0x51;
BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, scriptWitness);
assert(GetTransactionSigOpCost(CTransaction(spendingTx), coins, flags) == 0);
const auto [creationTx2, spendingTx2] = BuildTxs(coins, scriptPubKey, scriptSig, scriptWitness);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3ffffa0 test: Demonstrate new CTransaction constructor in sigopcount_tests:

Nit: creationTx2 is unused, also creationTx3.

bool ComputeHasWitness() const;

public:
CTransaction(std::vector<CTxIn> inputs, std::vector<CTxOut> outputs, uint32_t version = CURRENT_VERSION, uint32_t locktime = 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5d48cd3 CTransaction: Add a value constructor:

I suggest making this constructor explicit as well (all the other changes are compatible with it).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please look above: #36696 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, sorry for the duplication.


AddCoins(coins, CTransaction(creationTx), 0);
AddCoins(coins, creationTx, /*nHeight=*/0);
return {std::move(creationTx), std::move(spendingTx)};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3ffffa0 test: Demonstrate new CTransaction constructor in sigopcount_tests:

Nit: std::move of CTransaction is a copy, due to the const members. The move's here could be removed, as they don't really end up in a move, but copy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

CTransaction has a move constructor, which invokes the move constructor of each member. Because the members are const, they fall back to being copied. The fallback is not obvious to the client, otherwise clang-tidy would complain. As a user of CTransaction, you should not need to know about its members at all. std::move is semantically correct here, I'd say.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted

bool ComputeHasWitness() const;

public:
CTransaction(std::vector<CTxIn> inputs, std::vector<CTxOut> outputs, uint32_t version = CURRENT_VERSION, uint32_t locktime = 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5d48cd3 CTransaction: Add a value constructor:

The CURRENT_VERSION default value for version is taken over from CMutableTransaction. But I think it's better if version had no default; the CURRENT may change; 3 already exists; the version is quite important and it's better if specified explicitly; less confusion with the other the locktime parameter with default.
If the default value is removed, the rest of the changeset builds without further modifications.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants