Add extranonce_manager module in channels_sv2#2098
Open
GitGab19 wants to merge 4 commits intostratum-mining:mainfrom
Open
Add extranonce_manager module in channels_sv2#2098GitGab19 wants to merge 4 commits intostratum-mining:mainfrom
extranonce_manager module in channels_sv2#2098GitGab19 wants to merge 4 commits intostratum-mining:mainfrom
Conversation
b33c8be to
834b6ce
Compare
plebhash
reviewed
Mar 3, 2026
plebhash
reviewed
Mar 3, 2026
coleFD
reviewed
Mar 3, 2026
834b6ce to
7394b40
Compare
…ent in Sv2 channels
7394b40 to
6038120
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new
extranonce_managermodule inchannels_sv2centered aroundExtranonceAllocatorIt's a unified, reusable allocator for extranonce prefixes for both standard and extended channels.
It replaces the legacy
ExtendedExtranoncefactory frommining_sv2and 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