mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02: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:
parent
6e4d18f37f
commit
27e70f1f5b
16 changed files with 47 additions and 39 deletions
|
|
@ -174,9 +174,7 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
|
|||
|
||||
entry.pushKV("txid", tx.GetHash().GetHex());
|
||||
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<int64_t>(static_cast<uint32_t>(tx.nVersion)));
|
||||
entry.pushKV("version", tx.nVersion);
|
||||
entry.pushKV("size", tx.GetTotalSize());
|
||||
entry.pushKV("vsize", (GetTransactionWeight(tx) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR);
|
||||
entry.pushKV("weight", GetTransactionWeight(tx));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue