Skip to content

Commit 22433f8

Browse files
committed
functional_tests: fix piecemeal export in cold_signing
The `while` loop condition was incorrect, which could lead to incomplete imports. Also, setting `start` to an *undone* output speeds up the test by 16s on my machine.
1 parent a9b8a8a commit 22433f8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/functional_tests/cold_signing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ def export_import(self, piecemeal_output_export):
102102
res = self.hot_wallet.incoming_transfers()
103103
num_outputs = len(res.transfers)
104104
done = [False] * num_outputs
105-
while len([x for x in done if not done[x]]) > 0:
106-
start = int(random.random() * num_outputs)
107-
if start == num_outputs:
108-
num_outputs -= 1
105+
while len([x for x in done if not x]) > 0:
106+
start = random.choice([i for i in range(len(done)) if not done[i]]) # start at a random undone output
109107
count = 1 + int(random.random() * 5)
110108
res = self.hot_wallet.export_outputs(all = True, start = start, count = count)
111109

0 commit comments

Comments
 (0)