Skip to content

Add ARC-compatible status code to TransactionStatus responses#23

Closed
shruggr wants to merge 7 commits into
mainfrom
fix/arc-status-code
Closed

Add ARC-compatible status code to TransactionStatus responses#23
shruggr wants to merge 7 commits into
mainfrom
fix/arc-status-code

Conversation

@shruggr
Copy link
Copy Markdown
Collaborator

@shruggr shruggr commented Feb 18, 2026

Summary

  • Adds StatusCode int field (json:"status,omitempty") to TransactionStatus model
  • Sets StatusCode = 200 in route handlers (handlePostTx, handlePostTxs, handleGetTx) and webhook delivery
  • Required for ARC API compatibility — the go-sdk ArcResponse expects a status int in the JSON body, which clients like 1sat-indexer use to distinguish success (200) from not-found (404) when querying transaction status
  • Fixes double-close panic on shutdown when P2P client is provided externally. Services.Close() now respects ownsP2PClient and only closes the P2P client if Arcade created it. This prevents a close of closed channel panic when the caller (e.g. 1sat-stack) also closes the shared client during its own shutdown sequence.

Test plan

  • go build ./... passes
  • go test ./... passes
  • Verify GET /tx/{txid} response includes "status": 200
  • Verify POST /tx response includes "status": 200
  • Verify webhook callbacks include "status": 200 in payload
  • Verify clean shutdown when P2P client is passed in externally (no panic)

The go-sdk's ArcResponse expects a `status` int field in the JSON body
representing the HTTP status code. Clients like 1sat-indexer rely on this
to distinguish 200 vs 404 responses when querying transaction status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shruggr shruggr requested a review from mrz1836 as a code owner February 18, 2026 00:08
@github-actions github-actions Bot added size/XS Very small change (≤10 lines) bug-P3 Lowest rated bug, affects nearly none or low-impact feature Any new significant addition labels Feb 18, 2026
shruggr and others added 2 commits February 18, 2026 00:16
Ensures the JSON body includes `"status": 404` so ARC clients can
detect not-found via the response body, not just the HTTP status code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update ErrorFields references from errors.ErrorFields to arcerrors.ErrorFields
in swagger annotations, and regenerate docs to include new status field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrz1836 mrz1836 marked this pull request as draft February 19, 2026 14:15
@mrz1836
Copy link
Copy Markdown
Collaborator

mrz1836 commented Feb 19, 2026

@shruggr put back to draft:

  1. there are things in the PR body that might be incomplete, not sure
  2. CI has some linter/pre-commit issues

mrz1836 and others added 3 commits February 19, 2026 20:41
When a P2P client is passed into Arcade's Initialize(), Arcade should
not close it during Services.Close() — the caller owns it. The
ownsP2PClient guard was already used during initialization error
cleanup but was missing from the Close() method, causing a
double-close panic when the caller also closed the shared client.
@shruggr shruggr marked this pull request as ready for review March 4, 2026 17:45
Copy link
Copy Markdown
Collaborator

@mrz1836 mrz1836 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter issues should be cleaned up and then I can merge!

@shruggr shruggr closed this Mar 5, 2026
@shruggr shruggr deleted the fix/arc-status-code branch March 5, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-P3 Lowest rated bug, affects nearly none or low-impact feature Any new significant addition size/XS Very small change (≤10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants