mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-13 17:57:06 +02:00
Merge bitcoin/bitcoin#32765: test: Fix list index out of range error in feature_bip68_sequence.py
e285e691b7
test: Fix list index out of range error in feature_bip68_sequence.py (zaidmstrr) Pull request description: Fixes [#32334](https://github.com/bitcoin/bitcoin/issues/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 ACKe285e691b7
Prabhat1308: re-ACK [`e285e69`](e285e691b7
) theStack: ACKe285e691b7
Tree-SHA512: 2e5e19d5db2880915f556ed4444abed94e9ceb1ecee5f857df5616040c850dae682aaa4ade3060c48acb16676df92ba81c3af078c1958965e9e874e7bb489388
This commit is contained in:
@ -144,8 +144,10 @@ class BIP68Test(BitcoinTestFramework):
|
||||
# between height/time locking). Small random chance of making the locks
|
||||
# all pass.
|
||||
for _ in range(400):
|
||||
available_utxos = len(utxos)
|
||||
|
||||
# Randomly choose up to 10 inputs
|
||||
num_inputs = random.randint(1, 10)
|
||||
num_inputs = random.randint(1, min(10, available_utxos))
|
||||
random.shuffle(utxos)
|
||||
|
||||
# Track whether any sequence locks used should fail
|
||||
|
Reference in New Issue
Block a user