Skip to content

Commit 8c2b264

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 b512de7 commit 8c2b264

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
@@ -104,10 +104,8 @@ def export_import(self, piecemeal_output_export):
104104
res = self.hot_wallet.incoming_transfers()
105105
num_outputs = len(res.transfers)
106106
done = [False] * num_outputs
107-
while len([x for x in done if not done[x]]) > 0:
108-
start = int(random.random() * num_outputs)
109-
if start == num_outputs:
110-
num_outputs -= 1
107+
while len([x for x in done if not x]) > 0:
108+
start = random.choice([i for i in range(len(done)) if not done[i]]) # start at a random undone output
111109
count = 1 + int(random.random() * 5)
112110
res = self.hot_wallet.export_outputs(all = True, start = start, count = count)
113111

0 commit comments

Comments
 (0)