Skip to content

Commit 04472ed

Browse files
authored
Merge pull request #530 from evoskuil/master
Add set_filter_body(block) override.
2 parents 62067a4 + 3a3ee75 commit 04472ed

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,17 @@ bool CLASS::set_unstrong(const header_link& link) NOEXCEPT
704704
// ========================================================================
705705
}
706706

707+
TEMPLATE
708+
bool CLASS::set_prevouts(const header_link&, const block&) NOEXCEPT
709+
{
710+
// ========================================================================
711+
const auto scope = store_.get_transactor();
712+
713+
// TODO: implement.
714+
return {};
715+
// ========================================================================
716+
}
717+
707718
TEMPLATE
708719
bool CLASS::initialize(const block& genesis) NOEXCEPT
709720
{

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,23 @@ bool CLASS::get_filter_head(hash_digest& out,
198198
return true;
199199
}
200200

201+
TEMPLATE
202+
bool CLASS::set_filter_body(const header_link& link,
203+
const block& block) NOEXCEPT
204+
{
205+
filter bytes{};
206+
207+
// compute_filter is only false if prevouts are missing.
208+
return system::neutrino::compute_filter(bytes, block) &&
209+
set_filter_body(link, bytes);
210+
}
211+
201212
TEMPLATE
202213
bool CLASS::set_filter_body(const header_link&,
203214
const filter&) NOEXCEPT
204215
{
205-
////// GUARD (filter redundancy)
206-
////// This is only fully effective if there is a single database thread.
207-
////if (!to_filter(link).is_terminal())
208-
//// return true;
216+
if (!neutrino_enabled())
217+
return true;
209218

210219
// ========================================================================
211220
const auto scope = store_.get_transactor();
@@ -226,10 +235,8 @@ TEMPLATE
226235
bool CLASS::set_filter_head(const header_link&,
227236
const hash_digest&) NOEXCEPT
228237
{
229-
////// GUARD (filter redundancy)
230-
////// This is only fully effective if there is a single database thread.
231-
////if (!to_filter(link).is_terminal())
232-
//// return true;
238+
if (!neutrino_enabled())
239+
return true;
233240

234241
// ========================================================================
235242
const auto scope = store_.get_transactor();

include/bitcoin/database/query.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ class query
510510
/// Block association relies on strong (confirmed or pending).
511511
bool set_strong(const header_link& link) NOEXCEPT;
512512
bool set_unstrong(const header_link& link) NOEXCEPT;
513+
bool set_prevouts(const header_link& link, const block& block) NOEXCEPT;
513514
code block_confirmable(const header_link& link) const NOEXCEPT;
514515
////code tx_confirmable(const tx_link& link, const context& ctx) const NOEXCEPT;
515516
code unspent_duplicates(const header_link& coinbase,
@@ -538,6 +539,7 @@ class query
538539
/// Neutrino, set during validation with prevouts (surrogate-keyed).
539540
bool get_filter_body(filter& out, const header_link& link) const NOEXCEPT;
540541
bool get_filter_head(hash_digest& out, const header_link& link) const NOEXCEPT;
542+
bool set_filter_body(const header_link& link, const block& block) NOEXCEPT;
541543
bool set_filter_body(const header_link& link, const filter& body) NOEXCEPT;
542544
bool set_filter_head(const header_link& link,
543545
const hash_digest& head) NOEXCEPT;

0 commit comments

Comments
 (0)