Skip to content

Commit

Permalink
build fixup
Browse files Browse the repository at this point in the history
Signed-off-by: iceseer <[email protected]>
  • Loading branch information
iceseer committed Dec 10, 2024
1 parent d7bea9a commit e4906f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
26 changes: 13 additions & 13 deletions core/blockchain/impl/block_tree_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,18 +425,18 @@ namespace kagome::blockchain {
std::shared_ptr<storage::trie_pruner::TriePruner> state_pruner,
common::MainThreadPool &main_thread_pool)
: block_tree_data_{BlockTreeData{
.header_repo_ = std::move(header_repo),
.storage_ = std::move(storage),
.state_pruner_ = std::move(state_pruner),
.tree_ = std::make_unique<CachedTree>(finalized),
.extrinsic_observer_ = std::move(extrinsic_observer),
.hasher_ = std::move(hasher),
.extrinsic_event_key_repo_ = std::move(extrinsic_event_key_repo),
.justification_storage_policy_ =
std::move(justification_storage_policy),
.genesis_block_hash_ = {},
.blocks_pruning_ = {app_config.blocksPruning(), finalized.number},
}},
.header_repo_ = std::move(header_repo),
.storage_ = std::move(storage),
.state_pruner_ = std::move(state_pruner),
.tree_ = std::make_unique<CachedTree>(finalized),
.extrinsic_observer_ = std::move(extrinsic_observer),
.hasher_ = std::move(hasher),
.extrinsic_event_key_repo_ = std::move(extrinsic_event_key_repo),
.justification_storage_policy_ =
std::move(justification_storage_policy),
.genesis_block_hash_ = {},
.blocks_pruning_ = {app_config.blocksPruning(), finalized.number},
}},
chain_events_engine_{std::move(chain_events_engine)},
main_pool_handler_{main_thread_pool.handlerStarted()},
extrinsic_events_engine_{std::move(extrinsic_events_engine)} {
Expand Down Expand Up @@ -1252,7 +1252,7 @@ namespace kagome::blockchain {
[&](const BlockTreeData &p) { return getLeavesNoLock(p); });
}

std::vector<primitives::BlockInfo> getLeavesInfo() const {
std::vector<primitives::BlockInfo> BlockTreeImpl::getLeavesInfo() const {
return block_tree_data_.sharedAccess(
[&](const BlockTreeData &p) { return p.tree_->leafInfo(); });
}
Expand Down
20 changes: 10 additions & 10 deletions core/blockchain/impl/cached_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace kagome::blockchain {
void CachedTree::forceRefreshBest() {
std::set<std::shared_ptr<TreeNode>, Cmp> candidates;
for (auto &leaf : leaves_) {
auto node = find(leaf);
auto node = find(leaf.first);
BOOST_ASSERT(node);
candidates.emplace(std::move(node));
}
Expand All @@ -125,8 +125,9 @@ namespace kagome::blockchain {
CachedTree::CachedTree(const primitives::BlockInfo &root)
: root_{std::make_shared<TreeNode>(root)},
best_{root_},
nodes_{{root.hash, root_}},
leaves_{root.hash, root.number} {}
nodes_{{root.hash, root_}} {
leaves_.emplace(root.hash, root.number);
}

primitives::BlockInfo CachedTree::finalized() const {
return root_->info;
Expand All @@ -143,20 +144,19 @@ namespace kagome::blockchain {
std::vector<primitives::BlockInfo> CachedTree::leafInfo() const {
std::vector<primitives::BlockInfo> output;
output.reserve(leaves_.size());
std::ranges::transform(leaves_,
std::back_inserter(output),
[](const auto &v) {
return primitives::BlockInfo(v.first, v.second);
});
std::ranges::transform(
leaves_, std::back_inserter(output), [](const auto &v) {
return primitives::BlockInfo(v.first, v.second);
});
return output;
}

std::vector<primitives::BlockHash> CachedTree::leafHashes() const {
std::vector<primitives::BlockHash> output;
output.reserve(leaves_.size());
std::ranges::transform(leaves_,
std::back_inserter(output),
[](const auto &v) { return v.first; });
std::back_inserter(output),
[](const auto &v) { return v.first; });
return output;
}

Expand Down

0 comments on commit e4906f5

Please sign in to comment.