Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/bitcoin/database/impl/query/optional.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ code CLASS::get_confirmed_balance(std::atomic_bool& cancel, uint64_t& balance,
}

TEMPLATE
std::optional<hash_digest> CLASS::get_interval(header_link link,
std::optional<hash_digest> CLASS::get_interval(const header_link& link,
size_t height) const NOEXCEPT
{
// Interval is enabled by address table.
Expand All @@ -283,11 +283,12 @@ std::optional<hash_digest> CLASS::get_interval(header_link link,
return {};

// Generate the leaf nodes for the span.
auto header = link;
hashes leaves(span);
for (auto& leaf: std::views::reverse(leaves))
{
leaf = get_header_key(link);
link = to_parent(link);
leaf = get_header_key(header);
header = to_parent(header);
}

// Generate the interval (merkle root) for the span ending on link header.
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/database/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class query
bool turbo=false) const NOEXCEPT;

/// No value if header is not at configured interval.
std::optional<hash_digest> get_interval(header_link header,
std::optional<hash_digest> get_interval(const header_link& link,
size_t height) const NOEXCEPT;

bool is_filtered_body(const header_link& link) const NOEXCEPT;
Expand Down
Loading