Skip to content

Commit

Permalink
use apply_s for head_finality_data to simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 committed Mar 26, 2024
1 parent 5c82eec commit 21de5c4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4123,12 +4123,7 @@ struct controller_impl {
}

std::optional<finality_data_t> head_finality_data() const {
// We cannot use apply_s here as it returns an empty `finality_data_t` in
// Legacy, which causes SHiP to generate a null `finality_data` log
// (we want no `finality_data` is generated at all).
return apply<std::optional<finality_data_t>>(chain_head,
overloaded{ [](const block_state_legacy_ptr& head) { return std::nullopt; },
[](const block_state_ptr& head) { return head->get_finality_data(); }});
return apply_s<std::optional<finality_data_t>>(chain_head, [](const block_state_ptr& head) { return head->get_finality_data(); });
}

uint32_t earliest_available_block_num() const {
Expand Down

0 comments on commit 21de5c4

Please sign in to comment.