mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 13:54:44 +00:00
beacon_node, consensus: fix possible deadlocks when comparing with itself (#1241)
This commit is contained in:
@@ -5,6 +5,7 @@ use parking_lot::{RwLock, RwLockReadGuard};
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use std::collections::HashMap;
|
||||
use std::ptr;
|
||||
use types::{Epoch, Hash256, Slot};
|
||||
|
||||
pub const DEFAULT_PRUNE_THRESHOLD: usize = 256;
|
||||
@@ -51,6 +52,9 @@ pub struct ProtoArrayForkChoice {
|
||||
|
||||
impl PartialEq for ProtoArrayForkChoice {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
if ptr::eq(self, other) {
|
||||
return true;
|
||||
}
|
||||
*self.proto_array.read() == *other.proto_array.read()
|
||||
&& *self.votes.read() == *other.votes.read()
|
||||
&& *self.balances.read() == *other.balances.read()
|
||||
|
||||
Reference in New Issue
Block a user