Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions polkadot/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
None => Box::new(stdin()),
};

info!("Importing blocks");
let count: u32 = Decode::decode(&mut file).ok_or("Error reading file")?;
info!("Importing {} blocks", count);
let mut block = 0;
for _ in 0 .. count {
if exit_recv.try_recv().is_ok() {
Expand All @@ -448,7 +448,7 @@ fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
}
}
block += 1;
if block % 10000 == 0 {
if block % 1000 == 0 {
info!("#{}", block);
}
}
Expand Down
5 changes: 4 additions & 1 deletion substrate/codec/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ impl<'a> Input for &'a [u8] {
#[cfg(feature = "std")]
impl<R: ::std::io::Read> Input for R {
fn read(&mut self, into: &mut [u8]) -> usize {
(self as &mut ::std::io::Read).read(into).unwrap_or(0)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently reading from a file with read is interrupted on the buffer boundary.

match (self as &mut ::std::io::Read).read_exact(into) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this using Read as a trait object anyway?

Ok(()) => into.len(),
Err(_) => 0,
}
}
}

Expand Down