Removed assert

This commit is contained in:
arkpar 2017-04-05 16:50:06 +02:00
parent 81db3461fe
commit 03ec27be66
2 changed files with 6 additions and 2 deletions

View File

@ -103,8 +103,9 @@ pub fn to_fat_rlps(account_hash: &H256, acc: &BasicAccount, acct_db: &AccountDB,
}
if let Some(pair) = leftover.take() {
let leftover_appended = account_stream.append_raw_checked(&pair, 1, target_chunk_size);
assert!(leftover_appended);
if !account_stream.append_raw_checked(&pair, 1, target_chunk_size) {
return Err(Error::ChunkTooSmall);
}
}
loop {

View File

@ -55,6 +55,8 @@ pub enum Error {
Io(::std::io::Error),
/// Snapshot version is not supported.
VersionNotSupported(u64),
/// Max chunk size is to small to fit basic account data.
ChunkTooSmall,
}
impl fmt::Display for Error {
@ -76,6 +78,7 @@ impl fmt::Display for Error {
Error::Decoder(ref err) => err.fmt(f),
Error::Trie(ref err) => err.fmt(f),
Error::VersionNotSupported(ref ver) => write!(f, "Snapshot version {} is not supprted.", ver),
Error::ChunkTooSmall => write!(f, "Chunk size is too small."),
}
}
}