Skip to content

Commit 579b63c

Browse files
authored
Merge pull request #644 from evoskuil/master
Add filter parameter to get_validated_fork().
2 parents c5b8faa + 697785f commit 579b63c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/bitcoin/database/impl/query/height.ipp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ header_links CLASS::get_confirmed_fork(const header_link& fork) const NOEXCEPT
141141

142142
TEMPLATE
143143
header_states CLASS::get_validated_fork(size_t& fork_point,
144-
size_t top_checkpoint) const NOEXCEPT
144+
size_t top_checkpoint, bool filter) const NOEXCEPT
145145
{
146146
// Reservation may limit allocation to most common scenario.
147147
header_states out{};
@@ -154,7 +154,8 @@ header_states CLASS::get_validated_fork(size_t& fork_point,
154154
fork_point = get_fork_();
155155
auto height = add1(fork_point);
156156
auto link = to_candidate(height);
157-
while (is_block_validated(ec, link, height, top_checkpoint))
157+
while (is_block_validated(ec, link, height, top_checkpoint) &&
158+
(!filter || is_filtered(link)))
158159
{
159160
out.emplace_back(link, ec);
160161
link = to_candidate(++height);

include/bitcoin/database/query.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ class query
526526
header_links get_confirmed_fork(const header_link& fork) const NOEXCEPT;
527527
header_links get_candidate_fork(size_t& fork_point) const NOEXCEPT;
528528
header_states get_validated_fork(size_t& fork_point,
529-
size_t top_checkpoint=zero) const NOEXCEPT;
529+
size_t top_checkpoint=zero, bool filter=false) const NOEXCEPT;
530530

531531
bool initialize(const block& genesis) NOEXCEPT;
532532
bool push_candidate(const header_link& link) NOEXCEPT;

0 commit comments

Comments
 (0)