Skip to content

fix(3.3.1:24): ask which indexer to use, and never run without one configured - #83

Merged
MattDHill merged 1 commit into
masterfrom
fix/indexer-selection-never-asked
Aug 31, 2026
Merged

fix(3.3.1:24): ask which indexer to use, and never run without one configured#83
MattDHill merged 1 commit into
masterfrom
fix/indexer-selection-never-asked

Conversation

@MattDHill

Copy link
Copy Markdown
Member

What was broken

store.json.indexer has no default, and the select that sets it declared default: 'fulcrum' — so the form rendered as though Fulcrum were already chosen. Closing it without saving persisted nothing, and the task that would have forced the choice was gated on kind === 'install', so an install that updated into the feature was never asked at all.

With the choice unmade, setupDependencies declared no indexer and watchHosts omitted the ELECTRUM section — while MEMPOOL.BACKEND stayed pinned to z.literal('electrum'). Upstream's own ELECTRUM defaults then applied: 127.0.0.1:3306 with TLS on, which is this package's own MariaDB. The backend reconnected to it once a second, indefinitely:

ERR: Electrum error: {"reason":"wrong version number","code":"ERR_SSL_WRONG_VERSION_NUMBER"}
INFO: Disconnected from Electrum Server at 127.0.0.1:3306
[Warning] Aborted connection 578380 to db: 'unconnected' user: 'unauthenticated'

Both health checks stayed green throughout. Address lookups were silently dead, and nothing surfaced it.

The fix

  • actions/selectIndexer.ts — offers none and preselects nothing, so a choice has to be made rather than inherited.
  • init/taskSelectIndexer.ts — the critical task is raised whenever the choice is unmade, which reaches installs already in this state on their next start.
  • init/watchHosts.ts — writes MEMPOOL.BACKEND alongside ELECTRUM: electrum when an address resolved, none otherwise. The backend is never left on upstream's defaults.
  • file-models/mempool-config.json.tsBACKEND relaxed from z.literal('electrum') to z.enum(['none','electrum']).
  • file-models/store.json.tsindexer gains 'none': absent means the choice is unmade, 'none' means declined.

No migration. watchHosts repairs BACKEND on every init and the task reaches every affected install, so both halves heal on the next start.

default: null needs the SDK signature widened — Start9Labs/start-technologies#3871. The as any goes when that ships.

Verified on demo.local

Upgrading 3.3.1:233.3.1:24 on a box in the broken state (ELECTRUM: {}, BACKEND: "electrum", 578,380 aborted MariaDB connections):

Check Result
Task on an update, not just install mempool:select-indexer present, active: true, critical
Blocks startup Invalid Request: Service mempool has an unresolved critical task
BACKEND while unmade flipped to none; POLL_RATE_MS: 8000 intact, so the merge doesn't clobber siblings
Form renders unselected "default": null, "value": {} over the wire on SDK 2.0.9
Selecting Fulcrum ELECTRUM {HOST: 10.0.3.1, PORT: 51537, TLS_ENABLED: false}, BACKEND: electrum
Dependencies currentDependencies gained fulcrum
Task cleared gone from the task list
Service running, api and webui both success
Connection INFO: Connected to Electrum Server at 10.0.3.1:51537 (["Fulcrum 2.1.2","1.4"])
Error loop 0 Electrum errors and 0 aborted MariaDB connections since the upgrade

Not exercised: an address lookup through the published port — it wasn't reachable from the test shell. The Electrum handshake above is what the lookup depends on.

…nfigured

`store.json.indexer` has no default, and the select that sets it declared
`default: 'fulcrum'` — so the form rendered as though Fulcrum were already
chosen. Closing it without saving persisted nothing, and the task that would
have forced the choice was gated on `kind === 'install'`, so an install that
updated into the feature was never asked at all.

With the choice unmade, `setupDependencies` declared no indexer and
`watchHosts` omitted the `ELECTRUM` section, while `MEMPOOL.BACKEND` stayed
pinned to `'electrum'`. Upstream's own defaults then applied — `127.0.0.1:3306`
with TLS on, which is this package's MariaDB — and the backend reconnected to
it once a second indefinitely. Both health checks stayed green throughout;
address lookups were silently dead. A demo box had logged 578,380 aborted
MariaDB connections this way.

- The select offers `none` and preselects nothing, so a choice has to be made.
- The task is raised whenever the choice is unmade, which reaches installs
  already in this state on their next start.
- `watchHosts` writes `MEMPOOL.BACKEND` alongside `ELECTRUM` — `electrum` when
  an address resolved, `none` otherwise — so the backend is never left on
  upstream's defaults. `BACKEND` is relaxed from a literal to that pair.
- `store.json.indexer` gains `'none'`: absent means unmade, `'none'` means
  declined.

No migration — `watchHosts` repairs `BACKEND` on every init and the task
reaches every affected install, so both halves heal on the next start.

`default: null` needs the SDK signature widened
(Start9Labs/start-technologies#3871); the cast goes when that ships.

Verified on demo.local, upgrading 3.3.1:23 → 3.3.1:24 in the broken state:
the task appeared on an *update* and blocked startup; `BACKEND` flipped to
`none` with `POLL_RATE_MS` intact; selecting Fulcrum resolved
`ELECTRUM 10.0.3.1:51537 TLS_ENABLED false`, added `fulcrum` to
`currentDependencies`, and cleared the task; the service came up with both
health checks green and logged `Connected to Electrum Server at
10.0.3.1:51537 (["Fulcrum 2.1.2","1.4"])`. Zero Electrum errors and zero
aborted MariaDB connections since. An address lookup through the published
port was not exercised — the port was not reachable from the test shell.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@MattDHill
MattDHill force-pushed the fix/indexer-selection-never-asked branch from 7be0f1f to 984e280 Compare August 31, 2026 15:48
@MattDHill
MattDHill merged commit 3d3ad05 into master Aug 31, 2026
3 checks passed
@MattDHill
MattDHill deleted the fix/indexer-selection-never-asked branch August 31, 2026 16:48
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