diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-12-11 13:30:50 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-12-11 13:40:13 -0500 |
commit | aaaa8eb1edba2a28916d5da6001d421c1b1b253b (patch) | |
tree | 8a2f1d28c8da97de0a4b648ee031216fe4a63bae /test/functional | |
parent | fae3617d79deee73dd375dc3ea5f4204a74420c5 (diff) |
test: consensus: Check that final transactions are valid
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/mempool_accept.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py index bec6a0050a..442aa8e99a 100755 --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -6,6 +6,7 @@ from io import BytesIO import math + from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import ( BIP125_SEQUENCE_NUMBER, @@ -71,6 +72,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework): ))['hex'] txid_in_block = node.sendrawtransaction(hexstring=raw_tx_in_block, allowhighfees=True) node.generate(1) + self.mempool_size = 0 self.check_mempool_result( result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': '18: txn-already-known'}], rawtxs=[raw_tx_in_block], @@ -90,9 +92,25 @@ class MempoolAcceptanceTest(BitcoinTestFramework): rawtxs=[raw_tx_0], ) + self.log.info('A final transaction not in the mempool') + coin = node.listunspent()[0] # Pick a random coin(base) to spend + raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction( + inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL + outputs=[{node.getnewaddress(): 0.025}], + locktime=node.getblockcount() + 2000, # Can be anything + ))['hex'] + tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_final))) + self.check_mempool_result( + result_expected=[{'txid': tx.rehash(), 'allowed': True}], + rawtxs=[bytes_to_hex_str(tx.serialize())], + allowhighfees=True, + ) + node.sendrawtransaction(hexstring=raw_tx_final, allowhighfees=True) + self.mempool_size += 1 + self.log.info('A transaction in the mempool') node.sendrawtransaction(hexstring=raw_tx_0) - self.mempool_size = 1 + self.mempool_size += 1 self.check_mempool_result( result_expected=[{'txid': txid_0, 'allowed': False, 'reject-reason': '18: txn-already-in-mempool'}], rawtxs=[raw_tx_0], |