mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
consensus: Store transaction nVersion as uint32_t
Given that the use of a transaction's nVersion is always as an unsigned int, it doesn't make sense to store it as signed and then cast it to unsigned.
This commit is contained in:
@@ -45,7 +45,7 @@ CMutableTransaction ConsumeTransaction(FuzzedDataProvider& fuzzed_data_provider,
|
||||
const auto p2wsh_op_true = fuzzed_data_provider.ConsumeBool();
|
||||
tx_mut.nVersion = fuzzed_data_provider.ConsumeBool() ?
|
||||
CTransaction::CURRENT_VERSION :
|
||||
fuzzed_data_provider.ConsumeIntegral<int32_t>();
|
||||
fuzzed_data_provider.ConsumeIntegral<uint32_t>();
|
||||
tx_mut.nLockTime = fuzzed_data_provider.ConsumeIntegral<uint32_t>();
|
||||
const auto num_in = fuzzed_data_provider.ConsumeIntegralInRange<int>(0, max_num_in);
|
||||
const auto num_out = fuzzed_data_provider.ConsumeIntegralInRange<int>(0, max_num_out);
|
||||
|
||||
@@ -92,7 +92,7 @@ void static RandomScript(CScript &script) {
|
||||
|
||||
void static RandomTransaction(CMutableTransaction& tx, bool fSingle)
|
||||
{
|
||||
tx.nVersion = int(InsecureRand32());
|
||||
tx.nVersion = InsecureRand32();
|
||||
tx.vin.clear();
|
||||
tx.vout.clear();
|
||||
tx.nLockTime = (InsecureRandBool()) ? InsecureRand32() : 0;
|
||||
|
||||
@@ -780,7 +780,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
||||
CheckIsStandard(t);
|
||||
|
||||
// Disallowed nVersion
|
||||
t.nVersion = -1;
|
||||
t.nVersion = std::numeric_limits<uint32_t>::max();
|
||||
CheckIsNotStandard(t, "version");
|
||||
|
||||
t.nVersion = 0;
|
||||
|
||||
Reference in New Issue
Block a user