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

Duplicate line in /crates/curp/src/server/raw_curp/mod.rs #1044

Open
BaldDemian opened this issue Mar 11, 2025 · 2 comments
Open

Duplicate line in /crates/curp/src/server/raw_curp/mod.rs #1044

BaldDemian opened this issue Mar 11, 2025 · 2 comments

Comments

@BaldDemian
Copy link

BaldDemian commented Mar 11, 2025

Inside become_pre_candidate function in the file /crates/curp/src/server/raw_curp/mod.rs, this line of code initializing votes_received appears twice, but I can't think of an obvious reason. Could this be a mistake?
The first is line 1658

cst.votes_received = HashMap::from([(self.id(), true)]);

The second is line 1671
cst.votes_received = HashMap::from([(self.id(), true)]);

There doesn't seem to be any code between these two lines that makes reinitializing votes_received necessary.

cst.votes_received = HashMap::from([(self.id(), true)]);
st.leader_id = None;
let _ig = self.ctx.leader_tx.send(None).ok();
self.reset_election_tick();

if prev_role == Role::Follower {
    debug!("Follower {} starts pre election", self.id());
} else {
    debug!("PreCandidate {} restarts pre election", self.id());
}

// vote to self
debug!("{}'s vote is granted by server {}", self.id(), self.id());
cst.votes_received = HashMap::from([(self.id(), true)]);
Copy link

👋 Thanks for opening this issue!

Reply with the following command on its own line to get help or engage:

  • /contributing-agreement : to print Contributing Agreements.
  • /assignme : to assign this issue to you.

@BaldDemian
Copy link
Author

For your reference, the line of code initializing votes_received appears only once in the function become_candidate

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

No branches or pull requests

1 participant