328{
330
331 std::string str1;
332 char buf1[2048];
333 import_file.read(buf1, sizeof(file_magic));
334 if (! import_file)
335 throw std::runtime_error("Error reading expected number of bytes");
336 str1.assign(buf1, sizeof(file_magic));
337
339 throw std::runtime_error("Error in deserialization of file_magic");
340
341 if (file_magic != blockchain_raw_magic)
342 {
343 MFATAL(
"bootstrap file not recognized");
344 throw std::runtime_error("Aborting");
345 }
346 else
347 MINFO(
"bootstrap file recognized");
348
350
351 import_file.read(buf1, sizeof(buflen_file_info));
352 str1.assign(buf1, sizeof(buflen_file_info));
353 if (! import_file)
354 throw std::runtime_error("Error reading expected number of bytes");
356 throw std::runtime_error("Error in deserialization of buflen_file_info");
357 MINFO(
"bootstrap::file_info size: " << buflen_file_info);
358
359 if (buflen_file_info > sizeof(buf1))
360 throw std::runtime_error("Error: bootstrap::file_info size exceeds buffer size");
361 import_file.read(buf1, buflen_file_info);
362 if (! import_file)
363 throw std::runtime_error("Error reading expected number of bytes");
364 str1.assign(buf1, buflen_file_info);
365 bootstrap::file_info bfi;
367 throw std::runtime_error("Error in deserialization of bootstrap::file_info");
369 MINFO(
"bootstrap magic size: " <<
sizeof(file_magic));
371
373 import_file.seekg(full_header_size);
374
377 return full_header_size;
378}