mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-12 14:00:06 +00:00
Formatted changes using rustfmt
This commit is contained in:
parent
181aeb3d71
commit
4c45b90df5
@ -22,8 +22,8 @@ extern crate types;
|
||||
|
||||
pub mod bitwise_lmd_ghost;
|
||||
pub mod longest_chain;
|
||||
pub mod slow_lmd_ghost;
|
||||
pub mod optimized_lmd_ghost;
|
||||
pub mod slow_lmd_ghost;
|
||||
|
||||
use db::stores::BeaconBlockAtSlotError;
|
||||
use db::DBError;
|
||||
@ -31,8 +31,8 @@ use types::{BeaconBlock, ChainSpec, Hash256};
|
||||
|
||||
pub use bitwise_lmd_ghost::BitwiseLMDGhost;
|
||||
pub use longest_chain::LongestChain;
|
||||
pub use slow_lmd_ghost::SlowLMDGhost;
|
||||
pub use optimized_lmd_ghost::OptimizedLMDGhost;
|
||||
pub use slow_lmd_ghost::SlowLMDGhost;
|
||||
|
||||
/// Defines the interface for Fork Choices. Each Fork choice will define their own data structures
|
||||
/// which can be built in block processing through the `add_block` and `add_attestation` functions.
|
||||
@ -104,5 +104,5 @@ pub enum ForkChoiceAlgorithm {
|
||||
/// An optimised version of bitwise LMD-GHOST by Vitalik.
|
||||
BitwiseLMDGhost,
|
||||
/// An optimised implementation of LMD ghost.
|
||||
OptimizedLMDGhost
|
||||
OptimizedLMDGhost,
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ use db::{
|
||||
ClientDB,
|
||||
};
|
||||
use log::{debug, trace};
|
||||
use std::collections::HashMap;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use types::{
|
||||
readers::BeaconBlockReader, validator_registry::get_active_validator_indices, BeaconBlock,
|
||||
@ -202,12 +202,12 @@ where
|
||||
}
|
||||
|
||||
// Iterate through hashmap to get child with maximum votes
|
||||
let best_child = votes.iter().max_by(|(child1,v1), (child2, v2)| {
|
||||
let mut result = v1.cmp(v2);
|
||||
let best_child = votes.iter().max_by(|(child1, v1), (child2, v2)| {
|
||||
let mut result = v1.cmp(v2);
|
||||
// If votes are equal, choose smaller hash to break ties deterministically
|
||||
if result == Ordering::Equal {
|
||||
// Reverse so that max_by chooses smaller hash
|
||||
result = child1.cmp(child2).reverse();
|
||||
// Reverse so that max_by chooses smaller hash
|
||||
result = child1.cmp(child2).reverse();
|
||||
}
|
||||
result
|
||||
});
|
||||
|
@ -16,7 +16,9 @@ use bls::Signature;
|
||||
use db::stores::{BeaconBlockStore, BeaconStateStore};
|
||||
use db::MemoryDB;
|
||||
// use env_logger::{Builder, Env};
|
||||
use fork_choice::{BitwiseLMDGhost, OptimizedLMDGhost, ForkChoice, ForkChoiceAlgorithm, LongestChain, SlowLMDGhost};
|
||||
use fork_choice::{
|
||||
BitwiseLMDGhost, ForkChoice, ForkChoiceAlgorithm, LongestChain, OptimizedLMDGhost, SlowLMDGhost,
|
||||
};
|
||||
use ssz::ssz_encode;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
Loading…
Reference in New Issue
Block a user