@@ -52,7 +52,7 @@ uint64_t estimator::estimate(size_t target, mode mode) const NOEXCEPT
5252 estimate = compute (target, confidence::high);
5353 break ;
5454 }
55- case mode::markov :
55+ case mode::geometric :
5656 {
5757 estimate = compute (target, confidence::high, true );
5858 break ;
@@ -88,7 +88,7 @@ bool estimator::initialize(std::atomic_bool& cancel, const node::query& query,
8888 size_t top, size_t count) NOEXCEPT
8989{
9090 rate_sets blocks{};
91- return query.get_block_fees (cancel, blocks, top, count) &&
91+ return query.get_branch_fees (cancel, blocks, top, count) &&
9292 initialize (blocks);
9393}
9494
@@ -160,33 +160,35 @@ bool estimator::pop(const rates& block) NOEXCEPT
160160}
161161
162162uint64_t estimator::compute (size_t target, double confidence,
163- bool markov ) const NOEXCEPT
163+ bool geometric ) const NOEXCEPT
164164{
165165 const auto threshold = [](double part, double total, size_t ) NOEXCEPT
166166 {
167167 return part / total;
168168 };
169169
170170 // Geometric distribution approximation, not a full Markov process.
171- const auto geometric = [](double part, double total, size_t target) NOEXCEPT
171+ const auto markov = [](double part, double total, size_t target) NOEXCEPT
172172 {
173173 return system::power (part / total, target);
174174 };
175175
176176 const auto call = [&](const auto & buckets) NOEXCEPT
177177 {
178+ BC_PUSH_WARNING (NO_UNGUARDED_POINTERS)
179+ const auto & contribution = geometric ? markov : threshold;
180+ BC_POP_WARNING ()
181+
178182 constexpr auto magic_number = 2u ;
179183 const auto at_least_four = magic_number * add1 (target);
180- const auto & contribution = markov ? geometric : threshold;
181-
182184 double total{}, part{};
183185 auto index = buckets.size ();
184186 auto found = index;
185187 for (const auto & bucket: std::views::reverse (buckets))
186188 {
187189 --index;
188190 total += to_floating (bucket.total .load (relaxed));
189- part += to_floating (bucket.confirmed [ target] .load (relaxed));
191+ part += to_floating (bucket.confirmed . at ( target) .load (relaxed));
190192 if (total < at_least_four)
191193 continue ;
192194
@@ -258,7 +260,7 @@ bool estimator::update(const rates& block, size_t height, bool push) NOEXCEPT
258260
259261 // Clamp overflow to last bin.
260262 const auto bin = std::log (rate / sizing::min) / growth;
261- ++counts[ std::min (to_floored_integer (bin), sub1 (sizing::count))] ;
263+ ++counts. at ( std::min (to_floored_integer (bin), sub1 (sizing::count))) ;
262264 }
263265
264266 // At age zero scale term is one.
@@ -278,13 +280,13 @@ bool estimator::update(const rates& block, size_t height, bool push) NOEXCEPT
278280 continue ;
279281 }
280282
281- auto & bucket = buckets[ bin++] ;
283+ auto & bucket = buckets. at ( bin++) ;
282284 const auto scaled = to_floored_integer (count * scale);
283285 const auto signed_term = push ? scaled : twos_complement (scaled);
284286
285287 bucket.total .fetch_add (signed_term, relaxed);
286288 for (auto target = age; target < depth; ++target)
287- bucket.confirmed [ target] .fetch_add (signed_term, relaxed);
289+ bucket.confirmed . at ( target) .fetch_add (signed_term, relaxed);
288290 }
289291 };
290292
0 commit comments