Skip to content

Pool+JDC: handle new SeenSharesBudgetExhausted error variant from channels_sv2 share validation - #733

Draft
plebhash wants to merge 3 commits into
stratum-mining:mainfrom
plebhash:2026-08-17-channels-sv2-hardening
Draft

Pool+JDC: handle new SeenSharesBudgetExhausted error variant from channels_sv2 share validation#733
plebhash wants to merge 3 commits into
stratum-mining:mainfrom
plebhash:2026-08-17-channels-sv2-hardening

Conversation

@plebhash

@plebhash plebhash commented Aug 18, 2026

Copy link
Copy Markdown
Member

companion stratum-mining/stratum#2303

draft due to e6cb12f (avoids accidental merging)

but ready for review

channels_sv2 adds a SeenSharesBudgetExhausted variant to the server-side
ShareValidationError: validate_share returns it once a channel's
accepted-share dedup cache (seen_shares) reaches the budget derived from
its expected share rate. The variant carries no error code, so per the
enum's contract the embedding application should disconnect the client.

Both the standard and extended share-submission paths previously routed
this through their generic catch-all arm, which already disconnects, so
behavior was correct but the event was logged like any other channel
error. Add an explicit arm to both paths that names the condition (the
channel's share rate far outran its configured expectation, filling the
per-tip dedup cache) before disconnecting, so an operator can tell a
closed misbehaving channel apart from a transient fault. No
SubmitShares.Error is sent, since the variant has no error code.
…ation

JDC acts as a server toward its downstream miners, validating their
shares with server-side StandardChannel/ExtendedChannel. Those now return
the new ShareValidationError::SeenSharesBudgetExhausted variant when a
downstream channel fills its per-tip accepted-share dedup cache, but both
downstream share paths funneled every non-code-carrying variant into a
`_ => unreachable!()` arm, so this would panic the handler.

Add ShareValidationError to JDCErrorKind's ChannelSv2Error (with a From
impl, mirroring the pool) and an explicit arm on both the standard and
extended downstream paths that closes the offending downstream via
JDCError::disconnect. No SubmitShares.Error is sent, since the variant
has no error code to carry.

The upstream-facing paths validate with client-side channels, whose
ShareValidationError has no such variant, so they are unaffected.
DO NOT MERGE. Temporary commit so CI can build against the companion
stratum branch before it lands on stratum-mining/stratum.

Repoints the stratum-core git dependency from
stratum-mining/stratum#main to
plebhash/stratum#2026-08-17-channels-sv2-hardening (which carries the
SeenSharesBudgetExhausted variant these changes depend on) in
stratum-apps and bitcoin-core-sv2, and regenerates the committed
lockfiles so the --locked CI builds resolve the fork.

Revert this commit once the stratum PR is merged and stratum-core is
released (or the branch dependency is bumped to the merged rev).
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.

1 participant