Skip to content

reject undefined or unsupported SetupConnection flags - #244

Open
plebhash wants to merge 2 commits into
stratum-mining:mainfrom
plebhash:2026-10-21-reject-undefined-setup-connection-flags
Open

plebhash wants to merge 2 commits into
stratum-mining:mainfrom
plebhash:2026-10-21-reject-undefined-setup-connection-flags

Conversation

@plebhash

Copy link
Copy Markdown
Member

follow-up to #225

replaces #238


The spec implied that a server rejects flags it cannot satisfy, but said nothing about bits that no protocol defines, and told the client only to "act accordingly" when the server sets flags of its own. Both silences leave a reachable state with no specified next step.

This PR requires the server to answer SetupConnection.Error, naming the bits, when the client sets a flag that is undefined for the requested protocol or that the server does not support. This is fail-closed and reuses the probe mechanism in 3.6.3, so a future flag can be added without a version bump: older servers reject it by name and the client retries without it.

The client is likewise required to close the connection when it cannot satisfy a server flag or the server set an undefined one.

"Optional" is dropped from the flags field descriptions, where it contradicted "requires" in the same sentence.

Both SetupConnection.flags and SetupConnection.Success.flags were
described as "optional protocol features the client/server requires",
which contradicts itself: a flag either side sets is a requirement for
the connection, not an option. Every flag defined in chapters 5 and 6
is of that kind.

Discussion: stratum-mining#238
The spec implied that a server rejects flags it cannot satisfy, but said
nothing about bits that no protocol defines, and told the client only to
"act accordingly" when the server sets flags of its own. Both silences
leave a reachable state with no specified next step.

Require the server to answer SetupConnection.Error, naming the bits, when
the client sets a flag that is undefined for the requested protocol or
that the server does not support. This is fail-closed and reuses the
probe mechanism in 3.6.3, so a future flag can be added without a
version bump: older servers reject it by name and the client retries
without it. Require the client to close the connection when it cannot
satisfy a server flag or the server set an undefined one.

Discussion: stratum-mining#238
@plebhash
plebhash requested a review from Sjors October 21, 2026 12:56
@plebhash

plebhash commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

@Sjors is this aligned with what you were aiming for with #238 ?

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