@@ -204,6 +204,29 @@ def run_test(self):
204204 assert_equal (success , True )
205205 assert_equal (use_aps , None )
206206
207+ self .log .info ("Change position is -1 if no change is created with APS when APS was initially not used" )
208+ # We should have 2 tracepoints in the order:
209+ # 1. selected_coins (type 1)
210+ # 2. normal_create_tx_internal (type 2)
211+ # 3. attempting_aps_create_tx (type 3)
212+ # 4. selected_coins (type 1)
213+ # 5. aps_create_tx_internal (type 4)
214+ wallet .sendtoaddress (address = wallet .getnewaddress (), amount = wallet .getbalance (), subtractfeefromamount = True , avoid_reuse = False )
215+ events = self .get_tracepoints ([1 , 2 , 3 , 1 , 4 ])
216+ success , use_aps , algo , waste , change_pos = self .determine_selection_from_usdt (events )
217+ assert_equal (success , True )
218+ assert_equal (change_pos , - 1 )
219+
220+ self .log .info ("Change position is -1 if no change is created normally and APS is not used" )
221+ # We should have 2 tracepoints in the order:
222+ # 1. selected_coins (type 1)
223+ # 2. normal_create_tx_internal (type 2)
224+ wallet .sendtoaddress (address = wallet .getnewaddress (), amount = wallet .getbalance (), subtractfeefromamount = True )
225+ events = self .get_tracepoints ([1 , 2 ])
226+ success , use_aps , algo , waste , change_pos = self .determine_selection_from_usdt (events )
227+ assert_equal (success , True )
228+ assert_equal (change_pos , - 1 )
229+
207230 self .bpf .cleanup ()
208231
209232
0 commit comments