Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
fix tests: file wasn't opened with write option but we were trying to
Browse files Browse the repository at this point in the history
write
  • Loading branch information
liamsi committed Mar 6, 2019
1 parent ad05e72 commit 74f6c5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/last_sign_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use abscissa::Error;
use serde_json;
use std::{
fmt::{self, Display},
fs::File,
fs::{File, OpenOptions},
io::prelude::*,
path::Path,
};
Expand Down Expand Up @@ -70,7 +70,7 @@ impl LastSignState {
}
let mut lst = LastSignState {
data: EMPTY_DATA,
file: File::open(path)?,
file: OpenOptions::new().read(true).write(true).open(path)?,
_chain_id: chain_id,
};

Expand All @@ -82,7 +82,7 @@ impl LastSignState {

pub fn sync_to_disk(&mut self) -> std::io::Result<()> {
self.file
.write_all(serde_json::to_string(&self.data).unwrap().as_ref())?;
.write_all(serde_json::to_string(&self.data)?.as_ref())?;
self.file.sync_all()?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Session<SecretConnection<TcpStream>> {
let public_key = SecretConnectionKey::from(ed25519::public_key(&signer)?);
let connection = SecretConnection::new(socket, &public_key, &signer)?;
let last_sign_state = LastSignState::load_state(
Path::new(&(chain_id.as_ref().to_owned() + "_priv_validator_state.json")),
Path::new(&(chain_id.to_string() + "_priv_validator_state.json")),
chain_id,
)?;

Expand Down

0 comments on commit 74f6c5a

Please sign in to comment.