blockchain_utilities: report file offset where a read error occurs

This commit is contained in:
moneromooo-monero 2018-06-27 14:11:35 +01:00
parent 31f47d72fe
commit 80d7c6c730
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -400,18 +400,18 @@ uint64_t BootstrapFile::count_bytes(std::ifstream& import_file, uint64_t blocks,
{ {
std::cout << refresh_string; std::cout << refresh_string;
MWARNING("WARNING: chunk_size " << chunk_size << " > BUFFER_SIZE " << BUFFER_SIZE MWARNING("WARNING: chunk_size " << chunk_size << " > BUFFER_SIZE " << BUFFER_SIZE
<< " height: " << h-1); << " height: " << h-1 << ", offset " << bytes_read);
throw std::runtime_error("Aborting: chunk size exceeds buffer size"); throw std::runtime_error("Aborting: chunk size exceeds buffer size");
} }
if (chunk_size > CHUNK_SIZE_WARNING_THRESHOLD) if (chunk_size > CHUNK_SIZE_WARNING_THRESHOLD)
{ {
std::cout << refresh_string; std::cout << refresh_string;
MDEBUG("NOTE: chunk_size " << chunk_size << " > " << CHUNK_SIZE_WARNING_THRESHOLD << " << height: " MDEBUG("NOTE: chunk_size " << chunk_size << " > " << CHUNK_SIZE_WARNING_THRESHOLD << " << height: "
<< h-1); << h-1 << ", offset " << bytes_read);
} }
else if (chunk_size <= 0) { else if (chunk_size <= 0) {
std::cout << refresh_string; std::cout << refresh_string;
MDEBUG("ERROR: chunk_size " << chunk_size << " <= 0" << " height: " << h-1); MDEBUG("ERROR: chunk_size " << chunk_size << " <= 0" << " height: " << h-1 << ", offset " << bytes_read);
throw std::runtime_error("Aborting"); throw std::runtime_error("Aborting");
} }
// skip to next expected block size value // skip to next expected block size value