@@ -292,6 +292,16 @@ links_t schnorr::batch::get_failures(const stopper& cancel,
292292 return fails;
293293}
294294
295+ // get_match (silent)
296+ // ----------------------------------------------------------------------------
297+
298+ bool silent::batch::get_match (tx_link_t & , const batch& , size_t ,
299+ const ec_secret& ) NOEXCEPT
300+ {
301+ // TODO: implement.
302+ return false ;
303+ }
304+
295305// evaluate
296306// ----------------------------------------------------------------------------
297307// static/protected
@@ -347,7 +357,7 @@ links_t schnorr::batch::verify(const stopper& cancel,
347357
348358#if defined(HAVE_ULTRAFAST)
349359
350- void silent::batch::scan (const stopper& , const span & ,
360+ void silent::batch::scan (const stopper& , const batch & ,
351361 const ec_secret& , const handler& ) NOEXCEPT
352362{
353363 // TODO: iterate over chunked subsets or entire set.
@@ -356,11 +366,29 @@ void silent::batch::scan(const stopper& , const span& ,
356366
357367#else
358368
359- void silent::batch::scan (const stopper& , const span& ,
360- const ec_secret& , const handler& ) NOEXCEPT
369+ void silent::batch::scan (const stopper& cancel , const batch& batch ,
370+ const ec_secret& scan_key , const handler& callback, bool turbo ) NOEXCEPT
361371{
362- // TODO: iterate results set in cancellable parallel loop over full space.
363- // TODO: correlate matches to tx link and invoke callback.
372+ const auto policy = poolstl::execution::par_if (turbo);
373+
374+ // Three spans are corresponding arrays of equal length.
375+ const auto count = batch.correlates .size ();
376+ BC_ASSERT (batch.prefixes .size () == count);
377+ BC_ASSERT (batch.compresseds .size () == count);
378+
379+ std::vector<size_t > it (count);
380+ std::iota (it.begin (), it.end (), zero);
381+
382+ // Return from scan with !cancel implies complete.
383+ std::for_each (policy, it.cbegin (), it.cend (), [&](size_t row) NOEXCEPT
384+ {
385+ if (cancel)
386+ return ;
387+
388+ tx_link_t tx{};
389+ if (get_match (tx, batch, row, scan_key))
390+ callback ({}, tx);
391+ });
364392}
365393
366394#endif
0 commit comments