3030namespace libbitcoin {
3131namespace database {
3232
33- // fee estimate
34- // ----------------------------------------------------------------------------
35-
36- // protected
3733TEMPLATE
3834bool CLASS::get_block_fees (fee_rates& out,
3935 const header_link& link) const NOEXCEPT
@@ -58,7 +54,6 @@ bool CLASS::get_block_fees(fee_rates& out,
5854 return true ;
5955}
6056
61- // public
6257TEMPLATE
6358bool CLASS::get_block_fees (std::atomic_bool& cancel, fee_rate_sets& out,
6459 size_t top, size_t count) const NOEXCEPT
@@ -78,31 +73,22 @@ bool CLASS::get_block_fees(std::atomic_bool& cancel, fee_rate_sets& out,
7873 std::vector<size_t > offsets (count);
7974 std::iota (offsets.begin (), offsets.end (), zero);
8075
81- std::atomic_bool failure {};
76+ std::atomic_bool fail {};
8277 constexpr auto relaxed = std::memory_order_relaxed;
8378 std::for_each (poolstl::execution::par, offsets.begin (), offsets.end (),
8479 [&](const size_t & offset) NOEXCEPT
8580 {
86- if (failure.load (relaxed))
87- return ;
88-
89- if (cancel.load (relaxed))
90- {
91- failure.store (true , relaxed);
81+ if (fail.load (relaxed))
9282 return ;
93- }
9483
95- const auto link = to_confirmed (start + offset);
96- if (!get_block_fees (out.at (offset), link))
97- {
98- failure.store (false , relaxed);
99- return ;
100- }
84+ if (cancel.load (relaxed) || !get_block_fees (out.at (offset),
85+ to_confirmed (start + offset)))
86+ fail.store (true , relaxed);
10187 });
10288
103- const auto failed = failure .load (relaxed);
89+ const auto failed = fail .load (relaxed);
10490 if (failed) out.clear ();
105- return failed;
91+ return ! failed;
10692}
10793
10894} // namespace database
0 commit comments