Skip to content

Commit 35f683c

Browse files
authored
Merge branch 'unstable' into subnet-sampling
2 parents 8a095f1 + 46e0d66 commit 35f683c

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

beacon_node/beacon_chain/src/eth1_chain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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,

beacon_node/lighthouse_network/src/peer_manager/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)