Skip to content

Add extranonce_manager module in channels_sv2#2098

Open
GitGab19 wants to merge 4 commits intostratum-mining:mainfrom
GitGab19:extranonce-allocation
Open

Add extranonce_manager module in channels_sv2#2098
GitGab19 wants to merge 4 commits intostratum-mining:mainfrom
GitGab19:extranonce-allocation

Conversation

@GitGab19
Copy link
Member

@GitGab19 GitGab19 commented Mar 2, 2026

This PR introduces a new extranonce_manager module in channels_sv2 centered around ExtranonceAllocator

It's a unified, reusable allocator for extranonce prefixes for both standard and extended channels.

It replaces the legacy ExtendedExtranonce factory from mining_sv2 and provides a clearer, spec‑aligned, and more configurable way to size and manage extranonce space across pools, proxies (JDC/Translator), and other applications.

Internally, the allocator uses a compact bitmap (1 bit per channel) to track local_prefix_id usage, ensuring fast allocations, deterministic reuse when channels close, and no overlap between standard and extended channel prefixes.

This PR is inspired by the @coleFD's bitvec approach (see #2049), but it doesn't add any new external dependencies to our crates.

Closes #1924

companion stratum-mining/sv2-apps#310

@GitGab19 GitGab19 force-pushed the extranonce-allocation branch 5 times, most recently from b33c8be to 834b6ce Compare March 2, 2026 20:22
@GitGab19 GitGab19 force-pushed the extranonce-allocation branch from 7394b40 to 6038120 Compare March 8, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improved Extranonce Prefix Generation

3 participants