Skip to content

Conversation

@SirTyson
Copy link
Contributor

Description

Resolves #5099

This PR adds a check to HTTP endpoints and exits early if core is not in the correct state to service the endpoint. I've audited the endpoints and divided them into three categories:

  • Ledger State Dependent Endpoints (i.e. anything with a LedgerHeader or BucketList dependency). Here, we check that LedgerManager is not in LM_BOOTING_STATE such that there is some valid LCL state to query. These endpoints include:

    • /tx
    • /sorobaninfo
    • /upgrades
    • /dumpproposedsettings
    • /self-check
    • /maintenance
    • /getledgerentryraw
    • /getledgerentry
    • /info
  • Herder Dependent Endpoints. These don't need ledger state, but require overlay and herder to be initialized:

    • /peers
    • /connect
    • /droppeer
    • /bans
    • /unban
    • /quorum
    • /scp
    • /stopsurvey
    • /getsurveyresult
    • /startsurveycollecting
    • /stopsurveycollecting
    • /surveytopologytimesliced
  • No dependencies. These include all test-only endpoints for simplicity, as well as diagnostic info that should probably always be live, such as /metrics and /ll.

I thought about just delaying starting the endpoint (like the comment initially mentioned), but given the current length of our startup time, we need endpoints like /metrics available at a minimum. It is also probably better from a consumer view for captive-core to reply with a "not ready" status instead of less graceful errors.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@SirTyson SirTyson requested review from Copilot and marta-lokhova and removed request for Copilot January 23, 2026 22:31
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.

'tx' HTTP endpoint races with startup

1 participant