Add GET /pplns/mode/:address for UI mode detection#120
Closed
warioishere wants to merge 1 commit into
Closed
Conversation
Returns the mining mode the given BTC address is currently in: - group-solo: address is a member of an active group - pplns: address has shares in the PPLNS window - solo: otherwise (default for any fresh address) Used by the UI to pick the right dashboard layout per user without having to cross-reference /pplns/distribution and /pplns/groups client-side. 5 unit tests cover all mode transitions including the inactive-group edge case (a group with only 1 member falls through to pplns/solo).
This was referenced Apr 19, 2026
warioishere
added a commit
that referenced
this pull request
Apr 22, 2026
All of the following features were originally stacked as separate PRs on top of PPLNS: #119 feature/group-solo-mining group-solo engine + API #120 feature/mining-mode-endpoint GET /pplns/mode/:address #121 feature/block-template-mode-aware mode-aware block-template #122 feature/group-chart-endpoint chart + all security hardening + regtests Landing them as separate PRs would have exposed master to intermediate vulnerable states (selfLeave DoS, silent-add token leak, pending-out- of-coinbase math bug, etc.) until #122 closed the stack. All security and regtest work lived exclusively on #122, so merging the lower PRs first would ship a group-solo surface without its hardening. Rolling everything into #118 means the whole feature lands atomically on master with its full test + security story. PR #115 (JDP integration) stays separate, still upstream-blocked. # Conflicts: # src/controllers/pplns/pplns.controller.spec.ts # src/controllers/pplns/pplns.controller.ts
Owner
Author
6 tasks
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.
Summary
Adds a single endpoint the UI uses to learn what mining mode a given address is currently operating in:
```
GET /api/pplns/mode/:address
→ { "mode": "solo" | "pplns" | "group-solo", "groupId"?: "uuid" }
```
Resolution logic (in this order):
The UI (separate repo, separate PR) uses this to:
Backend-side this is a thin wrapper — `GroupService.getGroupForAddress` + `PplnsService.getCurrentDistribution`, both already exist and are cached.
Tests
5 unit tests (`pplns.controller.spec.ts`) cover all mode transitions and the inactive-group edge case (a group with only 1 member doesn't yet route as `group-solo` — falls through to PPLNS/solo).
Test plan