Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FIFO selection to prioritize OutputGroups with None sequence #47

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

BEULAHEVANJALIN
Copy link
Contributor

This PR updates the select_coin_fifo function to prioritize OutputGroups that have None as their creation_sequence, treating them as the earliest in the selection process. I've also included updates to the test cases to ensure that this behavior is correctly verified.

Copy link
Collaborator

@delcin-raj delcin-raj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inputs without sequence numbers should be pushed to the last of the Vec.
So they will be given least priority

src/lib.rs Outdated

sorted_inputs.sort_by_key(|(_, a)| a.creation_sequence);
let mut sorted_inputs = Vec::new();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't create this variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.


let mut sorted_inputs: Vec<_> = inputs.iter().enumerate().collect();
let mut inputs_without_sequence: Vec<_> = inputs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extend this with inputs without sequence after sorting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

@delcin-raj delcin-raj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@delcin-raj delcin-raj merged commit 25035c5 into Bitshala-Incubator:main Sep 6, 2024
4 checks passed
NeoZ666 pushed a commit to NeoZ666/rust-coinselect that referenced this pull request Sep 16, 2024
…itshala-Incubator#47)

* Update FIFO selection to prioritize OutputGroups with None sequence

* Prioritize OutputGroups with sequence numbers

* Fix Clippy warning by using  instead of

Signed-off-by: neoz666 <[email protected]>
NeoZ666 pushed a commit to NeoZ666/rust-coinselect that referenced this pull request Sep 16, 2024
…itshala-Incubator#47)

* Update FIFO selection to prioritize OutputGroups with None sequence

* Prioritize OutputGroups with sequence numbers

* Fix Clippy warning by using  instead of

Signed-off-by: neoz666 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants