diff --git a/libraries/state_history/include/eosio/state_history/log.hpp b/libraries/state_history/include/eosio/state_history/log.hpp index b1c1d15999..4df70bb963 100644 --- a/libraries/state_history/include/eosio/state_history/log.hpp +++ b/libraries/state_history/include/eosio/state_history/log.hpp @@ -145,26 +145,24 @@ std::vector zlib_decompress(fc::datastream& strm, uint64_t co template uint64_t read_unpacked_entry(Log&& log, Stream& stream, uint64_t payload_size, locked_decompress_stream& result) { - uint32_t s; - uint64_t compressed_size; - // result has state_history_log mutex locked + + uint32_t s; stream.read((char*)&s, sizeof(s)); if (s == 1 && payload_size > (s + sizeof(uint32_t))) { - compressed_size = payload_size - sizeof(uint32_t) - sizeof(uint64_t); + uint64_t compressed_size = payload_size - sizeof(uint32_t) - sizeof(uint64_t); uint64_t decompressed_size; stream.read((char*)&decompressed_size, sizeof(decompressed_size)); result.init(log, stream, compressed_size); return decompressed_size; - } else { // Compressed deltas now exceeds 4GB on one of the public chains. This length prefix // was intended to support adding additional fields in the future after the // packed deltas or packed traces. For now we're going to ignore on read. - compressed_size = payload_size - sizeof(uint32_t); + uint64_t compressed_size = payload_size - sizeof(uint32_t); + return result.init( zlib_decompress(stream, compressed_size) ); } - return result.init( zlib_decompress(stream, compressed_size) ); } class state_history_log_data : public chain::log_data_base { @@ -230,14 +228,14 @@ class state_history_log_data : public chain::log_data_base(&pos), sizeof(pos)); + index_file.write(reinterpret_cast(&pos), sizeof(pos)); pos += (sizeof(state_history_log_header) + payload_size + sizeof(uint64_t)); } } diff --git a/libraries/state_history/include/eosio/state_history/types.hpp b/libraries/state_history/include/eosio/state_history/types.hpp index 63cf7ca299..038f039184 100644 --- a/libraries/state_history/include/eosio/state_history/types.hpp +++ b/libraries/state_history/include/eosio/state_history/types.hpp @@ -109,7 +109,6 @@ struct get_blocks_result_base { std::optional block; }; - struct get_blocks_result_v0 : get_blocks_result_base { std::optional traces; std::optional deltas;