Skip to content

Commit

Permalink
GH-2045 No need to close or open fork_db
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 15, 2024
1 parent 6b62496 commit 852f69e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,14 @@ struct block_data_t {
account_name head_block_producer() const { return std::visit([](const auto& bd) { return bd.head->producer(); }, v); }

void transition_fork_db_to_if(const auto& vbsp) {
std::visit([](auto& bd) { bd.fork_db.close(); }, v);
// no need to close fork_db because we don't want to write anything out, file is removed on open
auto bsp = std::make_shared<block_state>(*std::get<block_state_legacy_ptr>(vbsp));
v.emplace<block_data_new_t>(std::visit([](const auto& bd) { return bd.fork_db.get_data_dir(); }, v));
std::visit(overloaded{
[](block_data_legacy_t&) {},
[&](block_data_new_t& bd) {
bd.head = bsp;
bd.fork_db.reset(*bd.head);
bd.fork_db.open({}); // no-op
}
}, v);
}
Expand Down

0 comments on commit 852f69e

Please sign in to comment.