Skip to content

Commit

Permalink
pr_update: fix of cleanup guard by comment and clang tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ErakhtinB committed Feb 21, 2025
1 parent 9070d99 commit 5c57799
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions core/parachain/validator/impl/parachain_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3387,14 +3387,10 @@ namespace kagome::parachain {
return;
}

struct CleanupGuard {
std::function<void()> cleanup;
~CleanupGuard() {
cleanup();
}
} cleanup_guard{[this, &block_hash] {
state_by_relay_parent_to_check_.erase(block_hash);
}};
auto cleanup_guard = std::unique_ptr<void, std::function<void(void *)>>(
reinterpret_cast<void *>(1), [this, &block_hash](void *) {
state_by_relay_parent_to_check_.erase(block_hash);
});

const auto &parachain_state = it->second;

Expand Down Expand Up @@ -3481,21 +3477,21 @@ namespace kagome::parachain {

if (explicit_found) {
SL_TRACE(logger_,
"Explicit vote found for parachain {} on relay parent {}",
parachain_id,
block_hash);
"Explicit vote found for parachain {} on relay parent {}",
parachain_id,
block_hash);
metric_kagome_parachain_candidate_explicit_votes_total_->inc();
} else if (implicit_found) {
SL_TRACE(logger_,
"Implicit vote found for parachain {} on relay parent {}",
parachain_id,
block_hash);
"Implicit vote found for parachain {} on relay parent {}",
parachain_id,
block_hash);
metric_kagome_parachain_candidate_implicit_votes_total_->inc();
} else {
SL_TRACE(logger_,
"No vote found for parachain {} on relay parent {}",
parachain_id,
block_hash);
"No vote found for parachain {} on relay parent {}",
parachain_id,
block_hash);
metric_kagome_parachain_candidate_no_votes_total_->inc();
}
}
Expand Down

0 comments on commit 5c57799

Please sign in to comment.