make the leader append to the ledger file

This commit is contained in:
Rob Walker 2018-07-03 15:05:53 -07:00 committed by Greg Fitzgerald
parent f38842822f
commit 800c2dd370
2 changed files with 10 additions and 7 deletions

View File

@ -6,7 +6,7 @@ use entry_writer;
use ncp::Ncp;
use packet::BlobRecycler;
use rpu::Rpu;
use std::fs::File;
use std::fs::{File, OpenOptions};
use std::io::{sink, stdin, stdout, BufReader};
use std::io::{Read, Write};
use std::net::SocketAddr;
@ -85,9 +85,13 @@ impl FullNode {
} else {
node.data.current_leader_id = node.data.id.clone();
let outfile_for_leader: Box<Write + Send> = match outfile_for_leader {
Some(OutFile::Path(file)) => {
Box::new(File::create(file).expect("opening ledger file"))
}
Some(OutFile::Path(file)) => Box::new(
OpenOptions::new()
.create(true)
.append(true)
.open(file)
.expect("opening ledger file"),
),
Some(OutFile::StdOut) => Box::new(stdout()),
None => Box::new(sink()),
};

View File

@ -7,7 +7,7 @@ extern crate solana;
use solana::crdt::TestNode;
use solana::crdt::{Crdt, ReplicatedData};
use solana::entry_writer::EntryWriter;
use solana::fullnode::{FullNode, InFile};
use solana::fullnode::{FullNode, InFile, OutFile};
use solana::logger;
use solana::mint::Mint;
use solana::ncp::Ncp;
@ -244,7 +244,6 @@ fn test_multi_node_basic() {
}
#[test]
#[ignore]
fn test_boot_validator_from_file() {
logger::setup();
let leader = TestNode::new();
@ -257,7 +256,7 @@ fn test_boot_validator_from_file() {
true,
InFile::Path(ledger_path.clone()),
None,
None,
Some(OutFile::Path(ledger_path.clone())),
exit.clone(),
);
let leader_balance =