mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 21:08:32 +00:00
Remove old debugging code, fix API fault
This commit is contained in:
@@ -17,4 +17,3 @@ eth2_ssz_derive = "0.1.0"
|
||||
serde = "1.0.102"
|
||||
serde_derive = "1.0.102"
|
||||
serde_yaml = "0.8.11"
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -18,7 +18,7 @@ pub struct ProtoNode {
|
||||
best_descendant: Option<usize>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Serialize, Deserialize)]
|
||||
#[derive(PartialEq, Debug, Serialize, Deserialize)]
|
||||
pub struct ProtoArray {
|
||||
/// Do not attempt to prune the tree unless it has at least this many nodes. Small prunes
|
||||
/// simply waste time.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use crate::error::Error;
|
||||
use crate::proto_array::ProtoArray;
|
||||
use crate::ssz_container::SszContainer;
|
||||
use parking_lot::RwLock;
|
||||
use serde_json;
|
||||
use parking_lot::{RwLock, RwLockReadGuard};
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use std::collections::HashMap;
|
||||
@@ -213,9 +212,11 @@ impl ProtoArrayForkChoice {
|
||||
.map_err(|e| format!("Failed to decode ProtoArrayForkChoice: {:?}", e))
|
||||
}
|
||||
|
||||
pub fn as_json(&self) -> Result<String, String> {
|
||||
serde_json::to_string(&*self.proto_array.read())
|
||||
.map_err(|e| format!("Failed to JSON encode proto_array: {:?}", e))
|
||||
/// Returns a read-lock to core `ProtoArray` struct.
|
||||
///
|
||||
/// Should only be used when encoding/decoding during troubleshooting.
|
||||
pub fn core_proto_array(&self) -> RwLockReadGuard<ProtoArray> {
|
||||
self.proto_array.read()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user