Skip to main content

Module pow_generator

Module pow_generator 

Source
Expand description

§Proof-of-work search engine

Proof-of-work is mandatory on every outgoing RPC, every peer announcement, and every piece of report/feedback — so finding a PoW solution quickly is on the hot path for virtually every client and server action. This module isolates that work behind a single trait, pow_generator::PowGenerator, so the calling code doesn’t care whether it’s running on a 32-core server or a single-threaded WASM Web Worker.

§Implementations

§Observability

pow_generator::JobTracker + pow_generator::PowJobStatus expose the set of in-flight PoW jobs and the best-so-far pow for each. The web client surfaces this in the UI so that when a post feels slow to send the user can see it’s because PoW is still grinding.

§Shared loop

[pow_generator::generate_loop] is the one-true batching loop used by both implementations: repeatedly call pow_generator::PowGenerator::generate_best_effort in 64K-attempt batches, update the tracker, and bail as soon as a batch returns pow >= pow_min. Every batch also yields to the runtime so on single-threaded targets other tasks still get a chance to run.

Modules§

native_parallel_pow_generator
Multi-core PoW search for non-WASM targets.
pow_generator
Trait, observability primitives, and shared work-stealing dispatcher for the PoW search engine.
single_threaded_pow_generator
Single-threaded PoW search that works on every target.