@@ -89,13 +89,14 @@ def set_autoix_spork_state(self, state):
89
89
self .nodes [0 ].spork ('SPORK_16_INSTANTSEND_AUTOLOCKS' , value )
90
90
91
91
# sends regular IX with high fee and may inputs (not-simple transaction)
92
- def send_regular_IX (self ):
92
+ def send_regular_IX (self , check_fee = True ):
93
93
receiver_addr = self .nodes [self .receiver_idx ].getnewaddress ()
94
94
txid = self .nodes [0 ].instantsendtoaddress (receiver_addr , 1.0 )
95
- MIN_FEE = satoshi_round (- 0.0001 )
96
- fee = self .nodes [0 ].gettransaction (txid )['fee' ]
97
- expected_fee = MIN_FEE * len (self .nodes [0 ].getrawtransaction (txid , True )['vin' ])
98
- assert_equal (fee , expected_fee )
95
+ if (check_fee ):
96
+ MIN_FEE = satoshi_round (- 0.0001 )
97
+ fee = self .nodes [0 ].gettransaction (txid )['fee' ]
98
+ expected_fee = MIN_FEE * len (self .nodes [0 ].getrawtransaction (txid , True )['vin' ])
99
+ assert_equal (fee , expected_fee )
99
100
return self .wait_for_instantlock (txid , self .nodes [0 ])
100
101
101
102
# sends simple trx, it should become IX if autolocks are allowed
@@ -115,6 +116,21 @@ def send_complex_tx(self):
115
116
def run_test (self ):
116
117
# make sure masternodes are synced
117
118
sync_masternodes (self .nodes )
119
+
120
+ self .nodes [0 ].spork ("SPORK_17_QUORUM_DKG_ENABLED" , 0 )
121
+ self .wait_for_sporks_same ()
122
+ self .mine_quorum ()
123
+
124
+ print ("Test old InstantSend" )
125
+ self .test_auto ();
126
+
127
+ self .nodes [0 ].spork ("SPORK_2_INSTANTSEND_ENABLED" , 1 )
128
+ self .wait_for_sporks_same ()
129
+
130
+ print ("Test new InstantSend" )
131
+ self .test_auto (True );
132
+
133
+ def test_auto (self , new_is = False ):
118
134
# feed the sender with some balance
119
135
sender_addr = self .nodes [self .sender_idx ].getnewaddress ()
120
136
self .nodes [0 ].sendtoaddress (sender_addr , 1 )
@@ -126,26 +142,26 @@ def run_test(self):
126
142
127
143
assert (not self .get_autoix_spork_state ())
128
144
129
- assert (self .send_regular_IX ())
130
- assert (not self .send_simple_tx ())
131
- assert (not self .send_complex_tx ())
145
+ assert (self .send_regular_IX (not new_is ))
146
+ assert (self . send_simple_tx () if new_is else not self .send_simple_tx ())
147
+ assert (self . send_complex_tx () if new_is else not self .send_complex_tx ())
132
148
133
149
self .activate_autoix_bip9 ()
134
150
self .set_autoix_spork_state (True )
135
151
136
152
assert (self .get_autoix_bip9_status () == 'active' )
137
153
assert (self .get_autoix_spork_state ())
138
154
139
- assert (self .send_regular_IX ())
155
+ assert (self .send_regular_IX (not new_is ))
140
156
assert (self .send_simple_tx ())
141
- assert (not self .send_complex_tx ())
157
+ assert (self . send_complex_tx () if new_is else not self .send_complex_tx ())
142
158
143
159
self .set_autoix_spork_state (False )
144
160
assert (not self .get_autoix_spork_state ())
145
161
146
- assert (self .send_regular_IX ())
147
- assert (not self .send_simple_tx ())
148
- assert (not self .send_complex_tx ())
162
+ assert (self .send_regular_IX (not new_is ))
163
+ assert (self . send_simple_tx () if new_is else not self .send_simple_tx ())
164
+ assert (self . send_complex_tx () if new_is else not self .send_complex_tx ())
149
165
150
166
151
167
if __name__ == '__main__' :
0 commit comments