Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Verify chain_head.dat does not exist on snapshot load #581

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,12 @@ void chain_plugin_impl::plugin_initialize(const variables_map& options) {
"--snapshot is incompatible with --genesis-json as the snapshot contains genesis information");

auto shared_mem_path = chain_config->state_dir / "shared_memory.bin";
EOS_ASSERT( !std::filesystem::is_regular_file(shared_mem_path),
plugin_config_exception,
"Snapshot can only be used to initialize an empty database." );
auto chain_head_path = chain_config->state_dir / chain_head_filename;
EOS_ASSERT(!std::filesystem::is_regular_file(shared_mem_path) &&
!std::filesystem::is_regular_file(chain_head_path),
plugin_config_exception,
"Snapshot can only be used to initialize an empty database, remove directory: ${d}",
("d", chain_config->state_dir.generic_string()));

auto block_log_chain_id = block_log::extract_chain_id(blocks_dir, retained_dir);

Expand Down