fix(arbitrary): fix UTXO selection loop to iterate over entries instead of repeating first - #9826
Merged
mergify[bot] merged 2 commits intoAug 26, 2025
Conversation
…ad of repeating first
arya2
reviewed
Aug 26, 2025
arya2
left a comment
Contributor
There was a problem hiding this comment.
Nice catch! This looks good pending a lint fix.
Co-authored-by: Arya <aryasolhi@gmail.com>
Contributor
Author
comitted, thanks for review |
arya2
approved these changes
Aug 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The find_valid_utxo_for_spend function was incorrectly using a while loop with
utxos.iter().next() which always returned the same first UTXO entry. This caused
the function to either select the first UTXO or fail after 100 attempts, instead
of properly scanning through available UTXOs.
Changed the loop to iterate over utxos.iter().take(100) to properly scan
different UTXO entries while maintaining the existing 100-entry limit for
performance reasons.
This fix improves the quality of generated test chains by enabling more
transparent spends from different UTXOs rather than repeatedly attempting
to spend the same first entry.