1308 {
1309
1310
1311
1312 using namespace std;
1321 ilog(
"block log version= ${version}",(
"version",
version));
1322 bool is_pruned = detail::is_pruned_log_and_mask_version(
version);
1323 SYS_ASSERT( !is_pruned, block_log_unsupported_version,
"Block log is currently in pruned format, it must be vacuumed before doing this operation");
1325
1332 }
1333 else {
1335 SYS_ASSERT(size == 1, block_log_exception,
"invalid format for file ${file}",
1341 }
1344 }
1345 else {
1347 "Block log ${file} is not supported. version: ${ver} and first_block: ${first_block} does not contain "
1348 "a genesis_state nor a chain_id.",
1350 }
1351
1354 size = fread ( (
char*)&actual_totem,
sizeof(actual_totem), 1,
blk_in);
1355
1357 "Expected to read ${size} bytes, but did not read any bytes", ("size", sizeof(actual_totem)));
1358 SYS_ASSERT(actual_totem == expected_totem, block_log_exception,
1359 "Expected separator between block log header and blocks was not found( expected: ${e}, actual: ${a} )",
1360 (
"e",
fc::to_hex((
char*)&expected_totem,
sizeof(expected_totem) ))(
"a",
fc::to_hex((
char*)&actual_totem,
sizeof(actual_totem) )));
1361 }
1362
1364
1365 const auto status = fseek(
ind_in, 0, SEEK_END);
1369
1372 "Block log ${file} was determined to have its first block at ${determined}, but the block index "
1373 "indicates the first block is at ${index}",
1377 }
#define SYS_THROW(exc_type, FORMAT,...)
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
std::string string() const
std::string generic_string() const
static const uint64_t npos
static bool contains_chain_id(uint32_t version, uint32_t first_block_num)
static bool is_supported_version(uint32_t version)
static bool contains_genesis_state(uint32_t version, uint32_t first_block_num)
static const Segment gs(Segment::gs)
static const Segment ds(Segment::ds)
void unpack(Stream &s, std::deque< T > &value)
fc::string to_hex(const char *d, uint32_t s)
unsigned __int64 uint64_t
uint64_t block_pos(uint32_t n)