diff options
author | 251 <13120787+251labs@users.noreply.github.com> | 2018-04-06 21:47:29 +0200 |
---|---|---|
committer | 251 <13120787+251labs@users.noreply.github.com> | 2018-04-06 21:47:29 +0200 |
commit | 09b30db2b02aef03d15c2def9181bce93db400bb (patch) | |
tree | a9bbc9e16aec979e3185813ec0bdb40e80596d82 | |
parent | 5f0c6a7b0e47e03f848dc992d37fe209dd9c6975 (diff) | |
download | bitcoin-09b30db2b02aef03d15c2def9181bce93db400bb.tar.xz |
Asserts that the tx version number is a signed 32-bit integer.
-rwxr-xr-x | test/functional/rpc_rawtransaction.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py index 825b897871..02792653c1 100755 --- a/test/functional/rpc_rawtransaction.py +++ b/test/functional/rpc_rawtransaction.py @@ -14,13 +14,10 @@ Test the following RPCs: from collections import OrderedDict from io import BytesIO +from test_framework.messages import CTransaction, ToHex from test_framework.test_framework import BitcoinTestFramework -from test_framework.messages import ( - CTransaction, -) from test_framework.util import * - class multidict(dict): """Dictionary that allows duplicate keys. @@ -363,5 +360,23 @@ class RawTransactionsTest(BitcoinTestFramework): decrawtx= self.nodes[0].decoderawtransaction(rawtx) assert_equal(decrawtx['vin'][0]['sequence'], 4294967294) + #################################### + # TRANSACTION VERSION NUMBER TESTS # + #################################### + + # Test the minimum transaction version number that fits in a signed 32-bit integer. + tx = CTransaction() + tx.nVersion = -0x80000000 + rawtx = ToHex(tx) + decrawtx = self.nodes[0].decoderawtransaction(rawtx) + assert_equal(decrawtx['version'], -0x80000000) + + # Test the maximum transaction version number that fits in a signed 32-bit integer. + tx = CTransaction() + tx.nVersion = 0x7fffffff + rawtx = ToHex(tx) + decrawtx = self.nodes[0].decoderawtransaction(rawtx) + assert_equal(decrawtx['version'], 0x7fffffff) + if __name__ == '__main__': RawTransactionsTest().main() |