Skip to content

Commit 429ec1a

Browse files
committed
refactor: Rename CTransaction::nVersion to version
In order to ensure that the change of nVersion to a uint32_t in the previous commit has no effect, rename nVersion to version in this commit so that reviewers can easily spot if a spot was missed or if there is a check somewhere whose semantics have changed.
1 parent 27e70f1 commit 429ec1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+139
-139
lines changed

contrib/signet/miner

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ def signet_txs(block, challenge):
5858
sd += block.nTime.to_bytes(4, "little")
5959

6060
to_spend = CTransaction()
61-
to_spend.nVersion = 0
61+
to_spend.version = 0
6262
to_spend.nLockTime = 0
6363
to_spend.vin = [CTxIn(COutPoint(0, 0xFFFFFFFF), b"\x00" + CScriptOp.encode_op_pushdata(sd), 0)]
6464
to_spend.vout = [CTxOut(0, challenge)]
6565
to_spend.rehash()
6666

6767
spend = CTransaction()
68-
spend.nVersion = 0
68+
spend.version = 0
6969
spend.nLockTime = 0
7070
spend.vin = [CTxIn(COutPoint(to_spend.sha256, 0), b"", 0)]
7171
spend.vout = [CTxOut(0, b"\x6a")]

doc/policy/mempool-replacements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ other consensus and policy rules, each of the following conditions are met:
1212

1313
1. The directly conflicting transactions all signal replaceability explicitly. A transaction is
1414
signaling BIP125 replaceability if any of its inputs have an nSequence number less than (0xffffffff - 1).
15-
A transaction also signals replaceability if its nVersion field is set to 3.
15+
A transaction also signals replaceability if its version field is set to 3.
1616

1717
*Rationale*: See [BIP125
1818
explanation](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki#motivation).

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
208208
throw std::runtime_error("Invalid TX version requested: '" + cmdVal + "'");
209209
}
210210

211-
tx.nVersion = newVersion;
211+
tx.version = newVersion;
212212
}
213213

214214
static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)

src/compressor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ struct ScriptCompression
5555
{
5656
/**
5757
* make this static for now (there are only 6 special scripts defined)
58-
* this can potentially be extended together with a new nVersion for
59-
* transactions, in which case this value becomes dependent on nVersion
58+
* this can potentially be extended together with a new version for
59+
* transactions, in which case this value becomes dependent on version
6060
* and nHeight of the enclosing transaction.
6161
*/
6262
static const unsigned int nSpecialScripts = 6;

src/consensus/tx_verify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags
4848
int nMinHeight = -1;
4949
int64_t nMinTime = -1;
5050

51-
bool fEnforceBIP68 = tx.nVersion >= 2 && flags & LOCKTIME_VERIFY_SEQUENCE;
51+
bool fEnforceBIP68 = tx.version >= 2 && flags & LOCKTIME_VERIFY_SEQUENCE;
5252

5353
// Do not enforce sequence numbers as a relative lock time
5454
// unless we have been instructed to

src/core_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
174174

175175
entry.pushKV("txid", tx.GetHash().GetHex());
176176
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
177-
entry.pushKV("version", tx.nVersion);
177+
entry.pushKV("version", tx.version);
178178
entry.pushKV("size", tx.GetTotalSize());
179179
entry.pushKV("vsize", (GetTransactionWeight(tx) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR);
180180
entry.pushKV("weight", GetTransactionWeight(tx));

src/kernel/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
3030
{
3131
CMutableTransaction txNew;
32-
txNew.nVersion = 1;
32+
txNew.version = 1;
3333
txNew.vin.resize(1);
3434
txNew.vout.resize(1);
3535
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));

src/policy/policy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ bool IsStandard(const CScript& scriptPubKey, const std::optional<unsigned>& max_
9393

9494
bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_datacarrier_bytes, bool permit_bare_multisig, const CFeeRate& dust_relay_fee, std::string& reason)
9595
{
96-
if (tx.nVersion > TX_MAX_STANDARD_VERSION || tx.nVersion < 1) {
96+
if (tx.version > TX_MAX_STANDARD_VERSION || tx.version < 1) {
9797
reason = "version";
9898
return false;
9999
}

src/policy/policy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool IsStandard(const CScript& scriptPubKey, const std::optional<unsigned>& max_
131131
// Changing the default transaction version requires a two step process: first
132132
// adapting relay policy by bumping TX_MAX_STANDARD_VERSION, and then later
133133
// allowing the new transaction version in the wallet/RPC.
134-
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{3};
134+
static constexpr decltype(CTransaction::version) TX_MAX_STANDARD_VERSION{3};
135135

136136
/**
137137
* Check for standard transaction types

src/policy/v3_policy.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ struct ParentInfo {
4343
const Txid& m_txid;
4444
/** Wtxid used for debug string */
4545
const Wtxid& m_wtxid;
46-
/** nVersion used to check inheritance of v3 and non-v3 */
47-
decltype(CTransaction::nVersion) m_version;
46+
/** version used to check inheritance of v3 and non-v3 */
47+
decltype(CTransaction::version) m_version;
4848
/** If parent is in mempool, whether it has any descendants in mempool. */
4949
bool m_has_mempool_descendant;
5050

5151
ParentInfo() = delete;
52-
ParentInfo(const Txid& txid, const Wtxid& wtxid, decltype(CTransaction::nVersion) version, bool has_mempool_descendant) :
52+
ParentInfo(const Txid& txid, const Wtxid& wtxid, decltype(CTransaction::version) version, bool has_mempool_descendant) :
5353
m_txid{txid}, m_wtxid{wtxid}, m_version{version},
5454
m_has_mempool_descendant{has_mempool_descendant}
5555
{}
@@ -66,7 +66,7 @@ std::optional<std::string> PackageV3Checks(const CTransactionRef& ptx, int64_t v
6666
const auto in_package_parents{FindInPackageParents(package, ptx)};
6767

6868
// Now we have all ancestors, so we can start checking v3 rules.
69-
if (ptx->nVersion == TRUC_VERSION) {
69+
if (ptx->version == TRUC_VERSION) {
7070
// SingleV3Checks should have checked this already.
7171
if (!Assume(vsize <= V3_MAX_VSIZE)) {
7272
return strprintf("v3 tx %s (wtxid=%s) is too big: %u > %u virtual bytes",
@@ -94,14 +94,14 @@ std::optional<std::string> PackageV3Checks(const CTransactionRef& ptx, int64_t v
9494
Assume(mempool_parent->GetCountWithDescendants() == 1);
9595
return ParentInfo{mempool_parent->GetTx().GetHash(),
9696
mempool_parent->GetTx().GetWitnessHash(),
97-
mempool_parent->GetTx().nVersion,
97+
mempool_parent->GetTx().version,
9898
/*has_mempool_descendant=*/mempool_parent->GetCountWithDescendants() > 1};
9999
} else {
100100
auto& parent_index = in_package_parents.front();
101101
auto& package_parent = package.at(parent_index);
102102
return ParentInfo{package_parent->GetHash(),
103103
package_parent->GetWitnessHash(),
104-
package_parent->nVersion,
104+
package_parent->version,
105105
/*has_mempool_descendant=*/false};
106106
}
107107
}();
@@ -146,14 +146,14 @@ std::optional<std::string> PackageV3Checks(const CTransactionRef& ptx, int64_t v
146146
} else {
147147
// Non-v3 transactions cannot have v3 parents.
148148
for (auto it : mempool_ancestors) {
149-
if (it->GetTx().nVersion == TRUC_VERSION) {
149+
if (it->GetTx().version == TRUC_VERSION) {
150150
return strprintf("non-v3 tx %s (wtxid=%s) cannot spend from v3 tx %s (wtxid=%s)",
151151
ptx->GetHash().ToString(), ptx->GetWitnessHash().ToString(),
152152
it->GetSharedTx()->GetHash().ToString(), it->GetSharedTx()->GetWitnessHash().ToString());
153153
}
154154
}
155155
for (const auto& index: in_package_parents) {
156-
if (package.at(index)->nVersion == TRUC_VERSION) {
156+
if (package.at(index)->version == TRUC_VERSION) {
157157
return strprintf("non-v3 tx %s (wtxid=%s) cannot spend from v3 tx %s (wtxid=%s)",
158158
ptx->GetHash().ToString(),
159159
ptx->GetWitnessHash().ToString(),
@@ -172,12 +172,12 @@ std::optional<std::pair<std::string, CTransactionRef>> SingleV3Checks(const CTra
172172
{
173173
// Check v3 and non-v3 inheritance.
174174
for (const auto& entry : mempool_ancestors) {
175-
if (ptx->nVersion != TRUC_VERSION && entry->GetTx().nVersion == TRUC_VERSION) {
175+
if (ptx->version != TRUC_VERSION && entry->GetTx().version == TRUC_VERSION) {
176176
return std::make_pair(strprintf("non-v3 tx %s (wtxid=%s) cannot spend from v3 tx %s (wtxid=%s)",
177177
ptx->GetHash().ToString(), ptx->GetWitnessHash().ToString(),
178178
entry->GetSharedTx()->GetHash().ToString(), entry->GetSharedTx()->GetWitnessHash().ToString()),
179179
nullptr);
180-
} else if (ptx->nVersion == TRUC_VERSION && entry->GetTx().nVersion != TRUC_VERSION) {
180+
} else if (ptx->version == TRUC_VERSION && entry->GetTx().version != TRUC_VERSION) {
181181
return std::make_pair(strprintf("v3 tx %s (wtxid=%s) cannot spend from non-v3 tx %s (wtxid=%s)",
182182
ptx->GetHash().ToString(), ptx->GetWitnessHash().ToString(),
183183
entry->GetSharedTx()->GetHash().ToString(), entry->GetSharedTx()->GetWitnessHash().ToString()),
@@ -189,8 +189,8 @@ std::optional<std::pair<std::string, CTransactionRef>> SingleV3Checks(const CTra
189189
static_assert(V3_ANCESTOR_LIMIT == 2);
190190
static_assert(V3_DESCENDANT_LIMIT == 2);
191191

192-
// The rest of the rules only apply to transactions with nVersion=3.
193-
if (ptx->nVersion != TRUC_VERSION) return std::nullopt;
192+
// The rest of the rules only apply to transactions with version=3.
193+
if (ptx->version != TRUC_VERSION) return std::nullopt;
194194

195195
if (vsize > V3_MAX_VSIZE) {
196196
return std::make_pair(strprintf("v3 tx %s (wtxid=%s) is too big: %u > %u virtual bytes",

src/policy/v3_policy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#include <set>
1616
#include <string>
1717

18-
// This module enforces rules for BIP 431 TRUC transactions (with nVersion=3) which help make
18+
// This module enforces rules for BIP 431 TRUC transactions (with version=3) which help make
1919
// RBF abilities more robust.
20-
static constexpr decltype(CTransaction::nVersion) TRUC_VERSION{3};
20+
static constexpr decltype(CTransaction::version) TRUC_VERSION{3};
2121

2222
// v3 only allows 1 parent and 1 child when unconfirmed.
2323
/** Maximum number of transactions including an unconfirmed tx and its descendants. */

src/primitives/transaction.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ std::string CTxOut::ToString() const
6363
return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, HexStr(scriptPubKey).substr(0, 30));
6464
}
6565

66-
CMutableTransaction::CMutableTransaction() : nVersion{CTransaction::CURRENT_VERSION}, nLockTime{0} {}
67-
CMutableTransaction::CMutableTransaction(const CTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion{tx.nVersion}, nLockTime{tx.nLockTime} {}
66+
CMutableTransaction::CMutableTransaction() : version{CTransaction::CURRENT_VERSION}, nLockTime{0} {}
67+
CMutableTransaction::CMutableTransaction(const CTransaction& tx) : vin(tx.vin), vout(tx.vout), version{tx.version}, nLockTime{tx.nLockTime} {}
6868

6969
Txid CMutableTransaction::GetHash() const
7070
{
@@ -92,8 +92,8 @@ Wtxid CTransaction::ComputeWitnessHash() const
9292
return Wtxid::FromUint256((HashWriter{} << TX_WITH_WITNESS(*this)).GetHash());
9393
}
9494

95-
CTransaction::CTransaction(const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion{tx.nVersion}, nLockTime{tx.nLockTime}, m_has_witness{ComputeHasWitness()}, hash{ComputeHash()}, m_witness_hash{ComputeWitnessHash()} {}
96-
CTransaction::CTransaction(CMutableTransaction&& tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), nVersion{tx.nVersion}, nLockTime{tx.nLockTime}, m_has_witness{ComputeHasWitness()}, hash{ComputeHash()}, m_witness_hash{ComputeWitnessHash()} {}
95+
CTransaction::CTransaction(const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), version{tx.version}, nLockTime{tx.nLockTime}, m_has_witness{ComputeHasWitness()}, hash{ComputeHash()}, m_witness_hash{ComputeWitnessHash()} {}
96+
CTransaction::CTransaction(CMutableTransaction&& tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), version{tx.version}, nLockTime{tx.nLockTime}, m_has_witness{ComputeHasWitness()}, hash{ComputeHash()}, m_witness_hash{ComputeWitnessHash()} {}
9797

9898
CAmount CTransaction::GetValueOut() const
9999
{
@@ -117,7 +117,7 @@ std::string CTransaction::ToString() const
117117
std::string str;
118118
str += strprintf("CTransaction(hash=%s, ver=%u, vin.size=%u, vout.size=%u, nLockTime=%u)\n",
119119
GetHash().ToString().substr(0,10),
120-
nVersion,
120+
version,
121121
vin.size(),
122122
vout.size(),
123123
nLockTime);

src/primitives/transaction.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ static constexpr TransactionSerParams TX_NO_WITNESS{.allow_witness = false};
197197

198198
/**
199199
* Basic transaction serialization format:
200-
* - uint32_t nVersion
200+
* - uint32_t version
201201
* - std::vector<CTxIn> vin
202202
* - std::vector<CTxOut> vout
203203
* - uint32_t nLockTime
204204
*
205205
* Extended transaction serialization format:
206-
* - uint32_t nVersion
206+
* - uint32_t version
207207
* - unsigned char dummy = 0x00
208208
* - unsigned char flags (!= 0)
209209
* - std::vector<CTxIn> vin
@@ -217,7 +217,7 @@ void UnserializeTransaction(TxType& tx, Stream& s, const TransactionSerParams& p
217217
{
218218
const bool fAllowWitness = params.allow_witness;
219219

220-
s >> tx.nVersion;
220+
s >> tx.version;
221221
unsigned char flags = 0;
222222
tx.vin.clear();
223223
tx.vout.clear();
@@ -257,7 +257,7 @@ void SerializeTransaction(const TxType& tx, Stream& s, const TransactionSerParam
257257
{
258258
const bool fAllowWitness = params.allow_witness;
259259

260-
s << tx.nVersion;
260+
s << tx.version;
261261
unsigned char flags = 0;
262262
// Consistency check
263263
if (fAllowWitness) {
@@ -305,7 +305,7 @@ class CTransaction
305305
// structure, including the hash.
306306
const std::vector<CTxIn> vin;
307307
const std::vector<CTxOut> vout;
308-
const uint32_t nVersion;
308+
const uint32_t version;
309309
const uint32_t nLockTime;
310310

311311
private:
@@ -378,7 +378,7 @@ struct CMutableTransaction
378378
{
379379
std::vector<CTxIn> vin;
380380
std::vector<CTxOut> vout;
381-
uint32_t nVersion;
381+
uint32_t version;
382382
uint32_t nLockTime;
383383

384384
explicit CMutableTransaction();

src/rpc/rawtransaction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,8 +1748,8 @@ static RPCHelpMan joinpsbts()
17481748
}
17491749
psbtxs.push_back(psbtx);
17501750
// Choose the highest version number
1751-
if (psbtx.tx->nVersion > best_version) {
1752-
best_version = psbtx.tx->nVersion;
1751+
if (psbtx.tx->version > best_version) {
1752+
best_version = psbtx.tx->version;
17531753
}
17541754
// Choose the lowest lock time
17551755
if (psbtx.tx->nLockTime < best_locktime) {
@@ -1760,7 +1760,7 @@ static RPCHelpMan joinpsbts()
17601760
// Create a blank psbt where everything will be added
17611761
PartiallySignedTransaction merged_psbt;
17621762
merged_psbt.tx = CMutableTransaction();
1763-
merged_psbt.tx->nVersion = best_version;
1763+
merged_psbt.tx->version = best_version;
17641764
merged_psbt.tx->nLockTime = best_locktime;
17651765

17661766
// Merge
@@ -1795,7 +1795,7 @@ static RPCHelpMan joinpsbts()
17951795

17961796
PartiallySignedTransaction shuffled_psbt;
17971797
shuffled_psbt.tx = CMutableTransaction();
1798-
shuffled_psbt.tx->nVersion = merged_psbt.tx->nVersion;
1798+
shuffled_psbt.tx->version = merged_psbt.tx->version;
17991799
shuffled_psbt.tx->nLockTime = merged_psbt.tx->nLockTime;
18001800
for (int i : input_indices) {
18011801
shuffled_psbt.AddInput(merged_psbt.tx->vin[i], merged_psbt.inputs[i]);

src/script/interpreter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,8 @@ class CTransactionSignatureSerializer
13211321
/** Serialize txTo */
13221322
template<typename S>
13231323
void Serialize(S &s) const {
1324-
// Serialize nVersion
1325-
::Serialize(s, txTo.nVersion);
1324+
// Serialize version
1325+
::Serialize(s, txTo.version);
13261326
// Serialize vin
13271327
unsigned int nInputs = fAnyoneCanPay ? 1 : txTo.vin.size();
13281328
::WriteCompactSize(s, nInputs);
@@ -1512,7 +1512,7 @@ bool SignatureHashSchnorr(uint256& hash_out, ScriptExecutionData& execdata, cons
15121512
ss << hash_type;
15131513

15141514
// Transaction level data
1515-
ss << tx_to.nVersion;
1515+
ss << tx_to.version;
15161516
ss << tx_to.nLockTime;
15171517
if (input_type != SIGHASH_ANYONECANPAY) {
15181518
ss << cache.m_prevouts_single_hash;
@@ -1594,7 +1594,7 @@ uint256 SignatureHash(const CScript& scriptCode, const T& txTo, unsigned int nIn
15941594

15951595
HashWriter ss{};
15961596
// Version
1597-
ss << txTo.nVersion;
1597+
ss << txTo.version;
15981598
// Input prevouts/nSequence (none/all, depending on flags)
15991599
ss << hashPrevouts;
16001600
ss << hashSequence;
@@ -1743,7 +1743,7 @@ bool GenericTransactionSignatureChecker<T>::CheckSequence(const CScriptNum& nSeq
17431743

17441744
// Fail if the transaction's version number is not set high
17451745
// enough to trigger BIP 68 rules.
1746-
if (txTo->nVersion < 2)
1746+
if (txTo->version < 2)
17471747
return false;
17481748

17491749
// Sequence numbers with their most significant bit set are not

src/script/miniscript.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ namespace internal {
251251
//! The maximum size of a witness item for a Miniscript under Tapscript context. (A BIP340 signature with a sighash type byte.)
252252
static constexpr uint32_t MAX_TAPMINISCRIPT_STACK_ELEM_SIZE{65};
253253

254-
//! nVersion + nLockTime
254+
//! version + nLockTime
255255
constexpr uint32_t TX_OVERHEAD{4 + 4};
256256
//! prevout + nSequence + scriptSig
257257
constexpr uint32_t TXIN_BYTES_NO_WITNESS{36 + 4 + 1};

src/signet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ static uint256 ComputeModifiedMerkleRoot(const CMutableTransaction& cb, const CB
6868
std::optional<SignetTxs> SignetTxs::Create(const CBlock& block, const CScript& challenge)
6969
{
7070
CMutableTransaction tx_to_spend;
71-
tx_to_spend.nVersion = 0;
71+
tx_to_spend.version = 0;
7272
tx_to_spend.nLockTime = 0;
7373
tx_to_spend.vin.emplace_back(COutPoint(), CScript(OP_0), 0);
7474
tx_to_spend.vout.emplace_back(0, challenge);
7575

7676
CMutableTransaction tx_spending;
77-
tx_spending.nVersion = 0;
77+
tx_spending.version = 0;
7878
tx_spending.nLockTime = 0;
7979
tx_spending.vin.emplace_back(COutPoint(), CScript(), 0);
8080
tx_spending.vout.emplace_back(0, CScript(OP_RETURN));

src/test/data/tx_invalid.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7c17aff532f22beb54069942f9bf567a66133eaf EQUAL"]],
247247
"0200000001000100000000000000000000000000000000000000000000000000000000000000000000030251b2000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
248248

249-
["Failure due to insufficient tx.nVersion (<2)"],
249+
["Failure due to insufficient tx.version (<2)"],
250250
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0 CHECKSEQUENCEVERIFY 1"]],
251251
"010000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "CHECKSEQUENCEVERIFY"],
252252
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194304 CHECKSEQUENCEVERIFY"]],

src/test/fuzz/package_eval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
173173
// Create transaction to add to the mempool
174174
const CTransactionRef tx = [&] {
175175
CMutableTransaction tx_mut;
176-
tx_mut.nVersion = fuzzed_data_provider.ConsumeBool() ? TRUC_VERSION : CTransaction::CURRENT_VERSION;
176+
tx_mut.version = fuzzed_data_provider.ConsumeBool() ? TRUC_VERSION : CTransaction::CURRENT_VERSION;
177177
tx_mut.nLockTime = fuzzed_data_provider.ConsumeBool() ? 0 : fuzzed_data_provider.ConsumeIntegral<uint32_t>();
178178
// Last tx will sweep all outpoints in package
179179
const auto num_in = last_tx ? package_outpoints.size() : fuzzed_data_provider.ConsumeIntegralInRange<int>(1, mempool_outpoints.size());

src/test/fuzz/tx_pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ FUZZ_TARGET(tx_pool_standard, .init = initialize_tx_pool)
226226
// Create transaction to add to the mempool
227227
const CTransactionRef tx = [&] {
228228
CMutableTransaction tx_mut;
229-
tx_mut.nVersion = fuzzed_data_provider.ConsumeBool() ? TRUC_VERSION : CTransaction::CURRENT_VERSION;
229+
tx_mut.version = fuzzed_data_provider.ConsumeBool() ? TRUC_VERSION : CTransaction::CURRENT_VERSION;
230230
tx_mut.nLockTime = fuzzed_data_provider.ConsumeBool() ? 0 : fuzzed_data_provider.ConsumeIntegral<uint32_t>();
231231
const auto num_in = fuzzed_data_provider.ConsumeIntegralInRange<int>(1, outpoints_rbf.size());
232232
const auto num_out = fuzzed_data_provider.ConsumeIntegralInRange<int>(1, outpoints_rbf.size() * 2);

0 commit comments

Comments
 (0)