Skip to content

Commit 342c81f

Browse files
authored
Merge pull request libbitcoin#703 from evoskuil/master
Add is_validated().
2 parents 9a1bca5 + e008f44 commit 342c81f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ inline bool CLASS::is_confirmable(const header_link& link) const NOEXCEPT
7777
return get_header_state(link) == error::block_confirmable;
7878
}
7979

80-
TEMPLATE
81-
inline bool CLASS::is_valid(const header_link& link) const NOEXCEPT
82-
{
83-
return get_header_state(link) == error::block_valid;
84-
}
85-
8680
// Empty/null_hash implies fault, zero count implies unassociated.
8781
// ----------------------------------------------------------------------------
8882

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ uint64_t CLASS::get_tx_fee(const tx_link& link) const NOEXCEPT
161161
return tx && populate_without_metadata(*tx) ? tx->fee() : max_uint64;
162162
}
163163

164+
TEMPLATE
165+
inline bool CLASS::is_validated(const header_link& link) const NOEXCEPT
166+
{
167+
// Validated and not invalid (checkpoint/milestone shows false).
168+
const auto state = get_header_state(link);
169+
return state == error::block_valid || state == error::block_confirmable;
170+
}
171+
164172
TEMPLATE
165173
bool CLASS::is_block_validated(code& state, const header_link& link,
166174
size_t height, size_t checkpoint) const NOEXCEPT

include/bitcoin/database/query.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class query
328328
inline bool is_milestone(const header_link& link) const NOEXCEPT;
329329
inline bool is_associated(const header_link& link) const NOEXCEPT;
330330
inline bool is_confirmable(const header_link& link) const NOEXCEPT;
331-
inline bool is_valid(const header_link& link) const NOEXCEPT;
331+
inline bool is_validated(const header_link& link) const NOEXCEPT;
332332

333333
/// Empty/null_hash implies fault, zero count implies unassociated.
334334
hash_digest get_top_confirmed_hash() const NOEXCEPT;

0 commit comments

Comments
 (0)