6
6
7
7
from io import BytesIO
8
8
import math
9
+
9
10
from test_framework .test_framework import BitcoinTestFramework
10
11
from test_framework .messages import (
11
12
BIP125_SEQUENCE_NUMBER ,
@@ -71,6 +72,7 @@ def run_test(self):
71
72
))['hex' ]
72
73
txid_in_block = node .sendrawtransaction (hexstring = raw_tx_in_block , allowhighfees = True )
73
74
node .generate (1 )
75
+ self .mempool_size = 0
74
76
self .check_mempool_result (
75
77
result_expected = [{'txid' : txid_in_block , 'allowed' : False , 'reject-reason' : '18: txn-already-known' }],
76
78
rawtxs = [raw_tx_in_block ],
@@ -90,9 +92,25 @@ def run_test(self):
90
92
rawtxs = [raw_tx_0 ],
91
93
)
92
94
95
+ self .log .info ('A final transaction not in the mempool' )
96
+ coin = node .listunspent ()[0 ] # Pick a random coin(base) to spend
97
+ raw_tx_final = node .signrawtransactionwithwallet (node .createrawtransaction (
98
+ inputs = [{'txid' : coin ['txid' ], 'vout' : coin ['vout' ], "sequence" : 0xffffffff }], # SEQUENCE_FINAL
99
+ outputs = [{node .getnewaddress (): 0.025 }],
100
+ locktime = node .getblockcount () + 2000 , # Can be anything
101
+ ))['hex' ]
102
+ tx .deserialize (BytesIO (hex_str_to_bytes (raw_tx_final )))
103
+ self .check_mempool_result (
104
+ result_expected = [{'txid' : tx .rehash (), 'allowed' : True }],
105
+ rawtxs = [bytes_to_hex_str (tx .serialize ())],
106
+ allowhighfees = True ,
107
+ )
108
+ node .sendrawtransaction (hexstring = raw_tx_final , allowhighfees = True )
109
+ self .mempool_size += 1
110
+
93
111
self .log .info ('A transaction in the mempool' )
94
112
node .sendrawtransaction (hexstring = raw_tx_0 )
95
- self .mempool_size = 1
113
+ self .mempool_size + = 1
96
114
self .check_mempool_result (
97
115
result_expected = [{'txid' : txid_0 , 'allowed' : False , 'reject-reason' : '18: txn-already-in-mempool' }],
98
116
rawtxs = [raw_tx_0 ],
0 commit comments