File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
lighthouse_network/src/peer_manager Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -475,10 +475,10 @@ impl<E: EthSpec> Eth1ChainBackend<E> for CachingEth1Backend<E> {
475475 voting_period_start_slot,
476476 ) ;
477477
478- let blocks = self . core . blocks ( ) . read ( ) ;
479-
480- let votes_to_consider =
481- get_votes_to_consider ( blocks . iter ( ) , voting_period_start_seconds , spec ) ;
478+ let votes_to_consider = {
479+ let blocks = self . core . blocks ( ) . read ( ) ;
480+ get_votes_to_consider ( blocks . iter ( ) , voting_period_start_seconds , spec )
481+ } ;
482482
483483 trace ! (
484484 self . log,
Original file line number Diff line number Diff line change @@ -2345,6 +2345,16 @@ mod tests {
23452345 gossipsub_score : f64 ,
23462346 }
23472347
2348+ // generate an arbitrary f64 while preventing NaN values
2349+ fn arbitrary_f64 ( g : & mut Gen ) -> f64 {
2350+ loop {
2351+ let val = f64:: arbitrary ( g) ;
2352+ if !val. is_nan ( ) {
2353+ return val;
2354+ }
2355+ }
2356+ }
2357+
23482358 impl Arbitrary for PeerCondition {
23492359 fn arbitrary ( g : & mut Gen ) -> Self {
23502360 let attestation_net_bitfield = {
@@ -2370,9 +2380,9 @@ mod tests {
23702380 outgoing : bool:: arbitrary ( g) ,
23712381 attestation_net_bitfield,
23722382 sync_committee_net_bitfield,
2373- score : f64 :: arbitrary ( g) ,
2383+ score : arbitrary_f64 ( g) ,
23742384 trusted : bool:: arbitrary ( g) ,
2375- gossipsub_score : f64 :: arbitrary ( g) ,
2385+ gossipsub_score : arbitrary_f64 ( g) ,
23762386 }
23772387 }
23782388 }
You can’t perform that action at this time.
0 commit comments