diff --git a/src/core_write.cpp b/src/core_write.cpp index 63f2c36b5af238..412869a7027739 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -176,7 +176,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry entry.pushKV("hash", tx.GetWitnessHash().GetHex()); // Transaction version is actually unsigned in consensus checks, just signed in memory, // so cast to unsigned before giving it to the user. - entry.pushKV("version", static_cast(static_cast(tx.nVersion))); + entry.pushKV("version", static_cast(tx.nVersion)); entry.pushKV("size", tx.GetTotalSize()); entry.pushKV("vsize", (GetTransactionWeight(tx) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR); entry.pushKV("weight", GetTransactionWeight(tx)); diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index ccbeb3ec49bb6c..36f8306439a2f6 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -197,13 +197,13 @@ static constexpr TransactionSerParams TX_NO_WITNESS{.allow_witness = false}; /** * Basic transaction serialization format: - * - int32_t nVersion + * - uint32_t nVersion * - std::vector vin * - std::vector vout * - uint32_t nLockTime * * Extended transaction serialization format: - * - int32_t nVersion + * - uint32_t nVersion * - unsigned char dummy = 0x00 * - unsigned char flags (!= 0) * - std::vector vin @@ -305,7 +305,7 @@ class CTransaction // structure, including the hash. const std::vector vin; const std::vector vout; - const int32_t nVersion; + const uint32_t nVersion; const uint32_t nLockTime; private: @@ -378,7 +378,7 @@ struct CMutableTransaction { std::vector vin; std::vector vout; - int32_t nVersion; + uint32_t nVersion; uint32_t nLockTime; explicit CMutableTransaction(); diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index c969ce45f12496..1ebf5425a5c611 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1743,7 +1743,7 @@ bool GenericTransactionSignatureChecker::CheckSequence(const CScriptNum& nSeq // Fail if the transaction's version number is not set high // enough to trigger BIP 68 rules. - if (static_cast(txTo->nVersion) < 2) + if (txTo->nVersion < 2) return false; // Sequence numbers with their most significant bit set are not diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index d008cb39aa22ec..0150e6156a760f 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -575,7 +575,7 @@ def __init__(self, tx=None): self.wit = copy.deepcopy(tx.wit) def deserialize(self, f): - self.nVersion = struct.unpack("