Skip to content

Add GET /pplns/mode/:address for UI mode detection#120

Closed
warioishere wants to merge 1 commit into
feature/group-solo-miningfrom
feature/mining-mode-endpoint
Closed

Add GET /pplns/mode/:address for UI mode detection#120
warioishere wants to merge 1 commit into
feature/group-solo-miningfrom
feature/mining-mode-endpoint

Conversation

@warioishere
Copy link
Copy Markdown
Owner

⚠️ Stacks on top of #119 (`feature/group-solo-mining`). Merge #118 then #119 first; GitHub will auto-update this PR's base to `blitzpool-master`.

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):

  1. If the address is a member of an active group → `group-solo` (includes `groupId`)
  2. If the address has shares in the PPLNS window → `pplns`
  3. Otherwise → `solo`

The UI (separate repo, separate PR) uses this to:

  • Hide solo-only menu items (Block Reward, Block Hit Calc) in non-solo modes
  • Hide the Block Luck widget (individual-hashrate-to-block-probability doesn't apply when a pool finds blocks)
  • Later: auto-redirect group-solo users to their group's dashboard

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

  • Full Jest suite green (505 tests, 59 suites)
  • Build clean

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).
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
@warioishere
Copy link
Copy Markdown
Owner Author

Superseded by #118 — all commits from this branch were rolled into feature/pplns-pool-support in the Collapse-Stack merge commit 75987d4 on 2026-04-22. The branch on origin is preserved (not deleted) so the history is recoverable if needed. See #118 for the consolidated diff and atomic merge.

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