aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-01 11:58:51 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-01 11:58:51 +0100
commite167c4d9a13849ae3e799571997bea843bda0683 (patch)
tree7e752f7ce09e776ccbc70cf94c07f74a21dbeaf0 /src
parentMerge pull request #2349 (diff)
downloadmonero-e167c4d9a13849ae3e799571997bea843bda0683.tar.xz
blockchain_import: do not error out on truncated files
This will happen often when downloading from a live file
Diffstat (limited to 'src')
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index ded854ca4..b5917f9c0 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -326,9 +326,19 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
}
import_file.read(buffer_block, chunk_size);
if (! import_file) {
- MFATAL("ERROR: unexpected end of file: bytes read before error: "
- << import_file.gcount() << " of chunk_size " << chunk_size);
- return 2;
+ if (import_file.eof())
+ {
+ std::cout << refresh_string;
+ MINFO("End of file reached - file was truncated");
+ quit = 1;
+ break;
+ }
+ else
+ {
+ MFATAL("ERROR: unexpected end of file: bytes read before error: "
+ << import_file.gcount() << " of chunk_size " << chunk_size);
+ return 2;
+ }
}
bytes_read += chunk_size;
MDEBUG("Total bytes read: " << bytes_read);