Repository navigation
Bound the stratum v2 target by the channel max_target. - #1244
Merged
Merged
Conversation
Contributor
Author
evoskuil
force-pushed
the
fix/sv2-max-target
branch
from
November 28, 2026 02:13
9f3d51d to
75ae2b2
Compare
evoskuil
force-pushed
the
fix/sv2-max-target
branch
from
November 28, 2026 04:35
75ae2b2 to
b3b0fce
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.
A stratum v2 downstream's
max_targetis the largest target it accepts, and the upstream must not exceed it. The channel kept it only as a difficulty floor, andto_share_targettruncates the difficulty mantissa to 32 bits, rounding the target up by up to 2^-31. So whenever the floor applied, the success target and SetTarget exceededmax_target. The SRI translator (v0.9.2) drops the upstream connection at the first such SetTarget (SetTargetAboveMaxTarget).Each channel now keeps
max_targetand the last target sent, and sends the lesser of the difficulty target andmax_target. SetTarget follows a change in that target, so an UpdateChannel that lowers it at unchanged difficulty refreshes the job (refreshis now protected). Shares are still checked against the difficulty target, which is not lower.The tests use a
max_targetone below the difficulty-one target. They fail without the change.Runtime on today's masters: of 300 random
max_targetvalues, 300 were exceeded before and 0 after. With the SRI translator over Noise on testnet5, master dropped at the first SetTarget; with the change it ran 20 minutes, 266 shares, 0 rejected.