aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-01-25 16:27:08 -0500
committerAva Chow <github@achow101.com>2024-06-07 12:40:21 -0400
commit27e70f1f5be1f536f2314cd2ea42b4f80d927fbd (patch)
tree0cdfa2c9d06bf39b9839de304975aba80caf3c28 /src/test
parent6e4d18f37f42894fe9a0d7948c1da3f061fc6b60 (diff)
downloadbitcoin-27e70f1f5be1f536f2314cd2ea42b4f80d927fbd.tar.xz
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/util.cpp2
-rw-r--r--src/test/sighash_tests.cpp2
-rw-r--r--src/test/transaction_tests.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/test/fuzz/util.cpp b/src/test/fuzz/util.cpp
index 259b00fcae..a1119297f4 100644
--- a/src/test/fuzz/util.cpp
+++ b/src/test/fuzz/util.cpp
@@ -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);
diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp
index d08d5519a1..d43c474ae1 100644
--- a/src/test/sighash_tests.cpp
+++ b/src/test/sighash_tests.cpp
@@ -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;
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index e6cf64611e..384babbde1 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -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;