diff options
author | Richard Myers <remyers@yakshaver.org> | 2024-01-17 15:57:02 +0100 |
---|---|---|
committer | Richard Myers <remyers@yakshaver.org> | 2024-01-20 14:56:41 +0100 |
commit | 2d58629ee63eebc760e2a9226afcd0c46d3ec2bd (patch) | |
tree | 65504074892710f9f31d1d4fe557b7389801b885 /test/functional/interface_usdt_coinselection.py | |
parent | 8106b268cde8e97a7c330afdda39b6bb55e5574a (diff) | |
download | bitcoin-2d58629ee63eebc760e2a9226afcd0c46d3ec2bd.tar.xz |
wallet: fix coin selection tracing to return -1 when no change pos
Diffstat (limited to 'test/functional/interface_usdt_coinselection.py')
-rwxr-xr-x | test/functional/interface_usdt_coinselection.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/interface_usdt_coinselection.py b/test/functional/interface_usdt_coinselection.py index aff90ea5fc..30931a41cd 100755 --- a/test/functional/interface_usdt_coinselection.py +++ b/test/functional/interface_usdt_coinselection.py @@ -204,6 +204,29 @@ class CoinSelectionTracepointTest(BitcoinTestFramework): assert_equal(success, True) assert_equal(use_aps, None) + self.log.info("Change position is -1 if no change is created with APS when APS was initially not used") + # We should have 2 tracepoints in the order: + # 1. selected_coins (type 1) + # 2. normal_create_tx_internal (type 2) + # 3. attempting_aps_create_tx (type 3) + # 4. selected_coins (type 1) + # 5. aps_create_tx_internal (type 4) + wallet.sendtoaddress(address=wallet.getnewaddress(), amount=wallet.getbalance(), subtractfeefromamount=True, avoid_reuse=False) + events = self.get_tracepoints([1, 2, 3, 1, 4]) + success, use_aps, algo, waste, change_pos = self.determine_selection_from_usdt(events) + assert_equal(success, True) + assert_equal(change_pos, -1) + + self.log.info("Change position is -1 if no change is created normally and APS is not used") + # We should have 2 tracepoints in the order: + # 1. selected_coins (type 1) + # 2. normal_create_tx_internal (type 2) + wallet.sendtoaddress(address=wallet.getnewaddress(), amount=wallet.getbalance(), subtractfeefromamount=True) + events = self.get_tracepoints([1, 2]) + success, use_aps, algo, waste, change_pos = self.determine_selection_from_usdt(events) + assert_equal(success, True) + assert_equal(change_pos, -1) + self.bpf.cleanup() |