Corrects small comments.
This commit is contained in:
parent
0f7167992b
commit
efa8aa19e7
@ -201,13 +201,14 @@ where
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finds the best child, splitting children into a binary tree, based on their hashes
|
// Finds the best child, splitting children into a binary tree, based on their hashes (Bitwise
|
||||||
|
// LMD Ghost)
|
||||||
fn choose_best_child(&self, votes: &HashMap<Hash256, u64>) -> Option<Hash256> {
|
fn choose_best_child(&self, votes: &HashMap<Hash256, u64>) -> Option<Hash256> {
|
||||||
if votes.is_empty() {
|
if votes.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut bitmask: BitVec = BitVec::new();
|
let mut bitmask: BitVec = BitVec::new();
|
||||||
// loop through bytes then bits
|
// loop through all bits
|
||||||
for bit in 0..=256 {
|
for bit in 0..=256 {
|
||||||
let mut zero_votes = 0;
|
let mut zero_votes = 0;
|
||||||
let mut one_votes = 0;
|
let mut one_votes = 0;
|
||||||
@ -216,16 +217,8 @@ where
|
|||||||
trace!("Child vote length: {}", votes.len());
|
trace!("Child vote length: {}", votes.len());
|
||||||
for (candidate, votes) in votes.iter() {
|
for (candidate, votes) in votes.iter() {
|
||||||
let candidate_bit: BitVec = BitVec::from_bytes(&candidate);
|
let candidate_bit: BitVec = BitVec::from_bytes(&candidate);
|
||||||
/*
|
|
||||||
trace!(
|
|
||||||
"Child: {} in bits: {:?}",
|
|
||||||
candidate,
|
|
||||||
candidate_bit
|
|
||||||
);
|
|
||||||
trace!("Current bitmask: {:?}", bitmask);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if the bitmasks don't match
|
// if the bitmasks don't match, exclude candidate
|
||||||
if !bitmask.iter().eq(candidate_bit.iter().take(bit)) {
|
if !bitmask.iter().eq(candidate_bit.iter().take(bit)) {
|
||||||
trace!(
|
trace!(
|
||||||
"Child: {} was removed in bit: {} with the bitmask: {:?}",
|
"Child: {} was removed in bit: {} with the bitmask: {:?}",
|
||||||
|
Loading…
Reference in New Issue
Block a user