160 {
162 SYS_ASSERT(_begin_block == _end_block || block_num <= _end_block, chain::plugin_exception,
163 "missed a block in ${name}.log", ("name", name));
164
165 if (_begin_block != _end_block && block_num > _begin_block) {
166 if (block_num == _end_block) {
167 SYS_ASSERT(prev_id == last_block_id, chain::plugin_exception,
"missed a fork change in ${name}.log",
168 ("name", name));
169 } else {
170 state_history_log_header prev;
172 SYS_ASSERT(prev_id == prev.block_id, chain::plugin_exception,
"missed a fork change in ${name}.log",
173 ("name", name));
174 }
175 }
176
177 if (block_num < _end_block)
178 truncate(block_num);
179 else if (!prune_config)
180 log.seek_end(0);
181 else if (prune_config && _begin_block != _end_block)
183
184
185 if(prune_config && _begin_block == _end_block)
187
190 write_payload(log);
191 SYS_ASSERT(log.tellp() == pos + state_history_log_header_serial_size + header.payload_size, chain::plugin_exception,
192 "wrote payload with incorrect size to ${name}.log", ("name", name));
194
196 if (_begin_block == _end_block)
197 _index_begin_block = _begin_block = block_num;
198 _end_block = block_num + 1;
199 last_block_id = header.block_id;
200
201 if(prune_config) {
202 if((pos&prune_config->prune_threshold) != (log.tellp()&prune_config->prune_threshold))
204
205 const uint32_t num_blocks_in_log = _end_block - _begin_block;
207 }
208 }
unsigned __int64 uint64_t