Consolidate ledger serialization code

The new read_entries() works, but is overly-contrained. Not
using that function yet, but adding it here in the hopes some
Rust guru will tell us how to get that lifetime constraint out
of there.

Fixes #517
This commit is contained in:
Greg Fitzgerald
2018-07-02 00:09:41 -06:00
committed by Greg Fitzgerald
parent e7b7dfebf5
commit ec7e50b37d
3 changed files with 18 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ use atty::{is, Stream};
use getopts::Options;
use solana::bank::Bank;
use solana::crdt::ReplicatedData;
use solana::entry::Entry;
use solana::entry_writer;
use solana::server::Server;
use std::env;
use std::fs::File;
@@ -68,11 +68,10 @@ fn main() {
eprintln!("Initializing...");
let stdin = stdin();
let entries = stdin.lock().lines().map(|line| {
let entry: Entry = serde_json::from_str(&line.unwrap()).unwrap_or_else(|e| {
entry_writer::read_entry(line.unwrap()).unwrap_or_else(|e| {
eprintln!("failed to parse json: {}", e);
exit(1);
});
entry
})
});
eprintln!("done parsing...");