mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Dump chain to JSON file
This commit is contained in:
@@ -6,7 +6,10 @@ use db::{
|
||||
stores::{BeaconBlockStore, BeaconStateStore},
|
||||
MemoryDB,
|
||||
};
|
||||
use serde_json::Result as SerdeResult;
|
||||
use slot_clock::TestingSlotClock;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::sync::Arc;
|
||||
use types::{ChainSpec, Keypair, Validator};
|
||||
|
||||
@@ -87,4 +90,10 @@ impl TestRig {
|
||||
pub fn chain_dump(&self) -> Result<Vec<SlotDump>, DumpError> {
|
||||
self.beacon_chain.chain_dump()
|
||||
}
|
||||
|
||||
pub fn dump_to_file(&self, filename: String, chain_dump: &Vec<SlotDump>) {
|
||||
let json = serde_json::to_string(chain_dump).unwrap();
|
||||
let mut file = File::create(filename).unwrap();
|
||||
file.write_all(json.as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user