Skip to content

Commit fa18304

Browse files
committed
Merge bitcoin/bitcoin#32765: test: Fix list index out of range error in feature_bip68_sequence.py
e285e69 test: Fix list index out of range error in feature_bip68_sequence.py (zaidmstrr) Pull request description: Fixes [#32334](bitcoin/bitcoin#32334) The test `feature_bip68_sequence.py` fails with `IndexError: list index out of range` error due to a mismatch between the number of inputs requested (at random) and the number of UTXOs available. The error is reproducible with the randomseed: ``` $ ./build/test/functional/feature_bip68_sequence.py --randomseed 6169832640268785903 ``` This PR adds a valid upper bound to randomly select the inputs. ACKs for top commit: maflcko: lgtm ACK e285e69 Prabhat1308: re-ACK [`e285e69`](bitcoin/bitcoin@e285e69) theStack: ACK e285e69 Tree-SHA512: 2e5e19d5db2880915f556ed4444abed94e9ceb1ecee5f857df5616040c850dae682aaa4ade3060c48acb16676df92ba81c3af078c1958965e9e874e7bb489388
2 parents e18322e + e285e69 commit fa18304

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/functional/feature_bip68_sequence.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ def test_sequence_lock_confirmed_inputs(self):
144144
# between height/time locking). Small random chance of making the locks
145145
# all pass.
146146
for _ in range(400):
147+
available_utxos = len(utxos)
148+
147149
# Randomly choose up to 10 inputs
148-
num_inputs = random.randint(1, 10)
150+
num_inputs = random.randint(1, min(10, available_utxos))
149151
random.shuffle(utxos)
150152

151153
# Track whether any sequence locks used should fail

0 commit comments

Comments
 (0)