mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Asserts that the tx version number is a signed 32-bit integer.
This commit is contained in:
parent
5f0c6a7b0e
commit
09b30db2b0
1 changed files with 19 additions and 4 deletions
|
@ -14,13 +14,10 @@ Test the following RPCs:
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
from test_framework.messages import CTransaction, ToHex
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.messages import (
|
|
||||||
CTransaction,
|
|
||||||
)
|
|
||||||
from test_framework.util import *
|
from test_framework.util import *
|
||||||
|
|
||||||
|
|
||||||
class multidict(dict):
|
class multidict(dict):
|
||||||
"""Dictionary that allows duplicate keys.
|
"""Dictionary that allows duplicate keys.
|
||||||
|
|
||||||
|
@ -363,5 +360,23 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
decrawtx= self.nodes[0].decoderawtransaction(rawtx)
|
decrawtx= self.nodes[0].decoderawtransaction(rawtx)
|
||||||
assert_equal(decrawtx['vin'][0]['sequence'], 4294967294)
|
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__':
|
if __name__ == '__main__':
|
||||||
RawTransactionsTest().main()
|
RawTransactionsTest().main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue