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

Improve readability for vote handling in active_transactions #4305

Conversation

gr0vity-dev
Copy link
Contributor

This PR breaks down the vote method in active_transactions.cpp into more modular functions, with the aim to improve the code's readability and maintainability.

I create this as draft PR to see if such refactors are desirable.

- Decomposed the `vote` method into smaller methods.
- Separated hash categorisation, inactive vote handling, vote processing, and republishing logic for clarity and maintainability.
- Enhanced readability by reducing the complexity of the primary vote processing function.
- Rename variables for clarity: `process` to `active_elections_hashes`, and `inactive` to `inactive_hashes`.
- Simplify hash categorization in `categorize_hashes` by removing the recently_confirmed_counter logic.
- Introduce `no_new_votes_present` method to check for replay votes based on recent confirmations.
…lity

- Renamed `process_votes` method to `handle_active_votes` to better convey its responsibility.
- Integrated the handling of `nano::vote_code::indeterminate` and subsequent replay check directly within the `handle_active_votes` method.
- rename `process` into `active_elections_hashes`
- rename `inactive`into `inactive_hashes`
@gr0vity-dev gr0vity-dev force-pushed the prs/refactor_act_tx_vote_flow branch from 5e3596d to ad309d6 Compare October 2, 2023 10:18
@gr0vity-dev gr0vity-dev closed this Oct 9, 2023
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.

1 participant