Skip to content

Commit

Permalink
GH-2057 Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Mar 19, 2024
1 parent 52eb338 commit 0a9f0c1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1923,17 +1923,14 @@ struct controller_impl {
block_state_pair get_block_state_to_snapshot() const
{
return apply<block_state_pair>(chain_head, overloaded{
[&](const block_state_legacy_ptr& head) {
[&](const block_state_legacy_ptr& head) -> block_state_pair {
if (fork_db.version_in_use() == fork_database::in_use_t::both) {
block_state_legacy_ptr legacy_head = head;
block_state_ptr savanna_head;
fork_db.apply_s<void>([&](const auto& forkdb) {
savanna_head = forkdb.head();
return fork_db.apply_s<block_state_pair>([&](const auto& forkdb) -> block_state_pair {
if (forkdb.root()->header.is_proper_svnn_block()) {
legacy_head.reset(); // not needed if past transition
return { {}, forkdb.head() }; // legacy not needed past transition
}
return { head, forkdb.head() };
});
return block_state_pair{ legacy_head, savanna_head };
}
return block_state_pair{ head, {} };
},
Expand Down

0 comments on commit 0a9f0c1

Please sign in to comment.