Skip to content

Commit b53c861

Browse files
committed
Comments.
1 parent d2c2573 commit b53c861

2 files changed

Lines changed: 3 additions & 36 deletions

File tree

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

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ bool CLASS::get_height(size_t& out, const hash_digest& key) const NOEXCEPT
279279
TEMPLATE
280280
bool CLASS::get_height(size_t& out, const header_link& link) const NOEXCEPT
281281
{
282-
// Use get_height(..., key) in place of get(to_header(key)).
283282
const auto height = get_height(link);
284283
if (height >= height_link::terminal)
285284
return false;
@@ -490,49 +489,16 @@ bool CLASS::get_block_spend(uint64_t& out,
490489
}
491490

492491
TEMPLATE
493-
bool CLASS::get_block_fee(uint64_t& out, const header_link& link) const NOEXCEPT
492+
bool CLASS::get_block_fee(uint64_t& out,
493+
const header_link& link) const NOEXCEPT
494494
{
495-
#if defined(SLOW_FEES)
496-
const auto block = get_block(link, false);
497-
if (!block || !populate_without_metadata(*block))
498-
return false;
499-
500-
out = block->fees();
501-
return true;
502-
#elif defined(FAST_FEES)
503495
uint64_t value{}, spend{};
504496
if (!get_block_value(value, link) || !get_block_spend(spend, link) ||
505497
spend > value)
506498
return false;
507499

508500
out = value - spend;
509501
return true;
510-
#else // FASTER_FEES
511-
table::txs::get_txs txs{};
512-
if (!store_.txs.at(to_txs(link), txs) || (txs.tx_fks.size() < one))
513-
return false;
514-
515-
std::atomic_bool fail{};
516-
const auto begin = std::next(txs.tx_fks.begin());
517-
constexpr auto parallel = poolstl::execution::par;
518-
constexpr auto relaxed = std::memory_order_relaxed;
519-
520-
out = std::transform_reduce(parallel, begin, txs.tx_fks.end(), 0_u64,
521-
[](uint64_t left, uint64_t right) NOEXCEPT
522-
{
523-
return system::ceilinged_add(left, right);
524-
},
525-
[&](const auto& tx_fk) NOEXCEPT
526-
{
527-
uint64_t fee{};
528-
if (!fail.load(relaxed) && !get_tx_fee(fee, tx_fk))
529-
fail.store(true, relaxed);
530-
531-
return fee;
532-
});
533-
534-
return !fail.load(relaxed);
535-
#endif // SLOW_FEES
536502
}
537503

538504
} // namespace database

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ typename CLASS::transaction::cptr CLASS::get_transaction(const tx_link& link,
186186
tx.locktime
187187
);
188188

189+
// TODO: store caches sizes so these could be forwarded.
189190
// Witness hash is not retained by the store.
190191
ptr->set_nominal_hash(std::move(tx.key));
191192
return ptr;

0 commit comments

Comments
 (0)