Dump transaction version as an unsigned integer in RPC/TxToUniv

Consensus-wise we already treat it as an unsigned integer (the
only rules around it are in CSV/locktime handling), but changing
the underlying data type means touching consensus code for a
simple cleanup change, which isn't really worth it.

See-also, https://github.com/rust-bitcoin/rust-bitcoin/pull/299
This commit is contained in:
Matt Corallo
2019-08-01 17:54:48 -04:00
parent e653eeff76
commit 970de70bdd
3 changed files with 12 additions and 2 deletions

View File

@ -417,11 +417,12 @@ class RawTransactionsTest(BitcoinTestFramework):
####################################
# Test the minimum transaction version number that fits in a signed 32-bit integer.
# As transaction version is unsigned, this should convert to its unsigned equivalent.
tx = CTransaction()
tx.nVersion = -0x80000000
rawtx = ToHex(tx)
decrawtx = self.nodes[0].decoderawtransaction(rawtx)
assert_equal(decrawtx['version'], -0x80000000)
assert_equal(decrawtx['version'], 0x80000000)
# Test the maximum transaction version number that fits in a signed 32-bit integer.
tx = CTransaction()