Skip to content

Conversation

@Stephen-Thomson
Copy link
Collaborator

Description of Changes

  • ARC can return HTTP 200 with txStatus values that indicate failures (e.g., DOUBLE_SPEND_ATTEMPTED, SEEN_IN_ORPHAN_MEMPOOL)
  • Previously, any HTTP 200 response was treated as success, causing isBroadcastFailure() to incorrectly return false
  • Now the broadcast() method checks txStatus and extraInfo for error conditions and returns a BroadcastFailure appropriately
    Error statuses now detected:
    • DOUBLE_SPEND_ATTEMPTED
      - REJECTED
    • INVALID
    • MALFORMED
    • MINED_IN_STALE_BLOCK
    • Any response containing "ORPHAN" in txStatus or extraInfo

Linked Issues / Tickets

Closes Issue #105

Testing Procedure

  • Added test: "should return error for DOUBLE_SPEND_ATTEMPTED even with HTTP 200"

  • Added test: "should return error for SEEN_IN_ORPHAN_MEMPOOL even with HTTP 200"

  • Added test: "should return error for REJECTED status even with HTTP 200"

  • Added test: "should still return success for valid txStatus values"

  • I have added new unit tests

  • All tests pass locally

  • I have tested manually in my local environment

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have updated CHANGELOG.md with my changes
  • I have run npm run doc and npm run lint one final time before requesting a review
  • I have fixed all linter errors to ensure these changes are compliant with ts-standard
  • I have run npm version patch so that my changes will trigger a new version to be released when they are merged

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
37.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/script/templates/PushDrop.ts 92.85% 1 Missing ⚠️
src/transaction/broadcasters/ARC.ts 92.85% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link

🏁 Benchmark Comparison (Node 22)

Comparing this PR (8d3f5ad) against master (fe07829).

✅ No regressions over the 5% threshold detected.

Benchmark Metric PR Branch Master Δ Change
BigNumber Arithmetic mul large numbers 8.86 ms 8.85 ms +0.01 ms +0.11%
BigNumber Arithmetic add large numbers 1.45 ms 1.45 ms +0.00 ms 0.00%
BigNumber Serialization toSm big 2.80 ms 2.81 ms -0.01 ms -0.36%
BigNumber Serialization toSm little 2.89 ms 2.88 ms +0.01 ms +0.35%
BigNumber Serialization fromSm big 2.99 ms 2.99 ms +0.00 ms 0.00%
BigNumber Serialization fromSm little 3.07 ms 3.05 ms +0.02 ms +0.66%
BigNumber Serialization fromScriptNum 3.08 ms 3.11 ms -0.03 ms -0.96%
Script Serialization Big script round trip 3.74 ms 3.78 ms -0.04 ms -1.06%
Transaction Verification deep chain verify 561.03 ms 568.79 ms -7.76 ms -1.36%
Transaction Verification wide transaction verify 570.91 ms 573.05 ms -2.14 ms -0.37%
Transaction Verification large tx verify 283.23 ms 282.09 ms +1.14 ms +0.40%
Transaction Verification nested inputs verify 161.73 ms 157.77 ms +3.96 ms +2.51%
Symmetric Key encrypt large 2MB 1750.63 ms 1729.37 ms +21.26 ms +1.23%
Symmetric Key decrypt large 2MB 1709.52 ms 1690.94 ms +18.58 ms +1.10%
Symmetric Key encrypt 50 small 7.55 ms 7.49 ms +0.06 ms +0.80%
Symmetric Key decrypt 50 small 7.16 ms 7.08 ms +0.08 ms +1.13%
Symmetric Key encrypt 200 medium 184.13 ms 182.24 ms +1.89 ms +1.04%
Symmetric Key decrypt 200 medium 179.27 ms 175.92 ms +3.35 ms +1.90%
Reader & Writer mixed ops 0.22 ms 0.22 ms +0.00 ms 0.00%
Reader & Writer large payloads 25.98 ms 26.15 ms -0.17 ms -0.65%
Reader & Writer 3000 small payloads 1.68 ms 1.72 ms -0.04 ms -2.33%
Reader & Writer 400 medium payloads 14.28 ms 14.44 ms -0.16 ms -1.11%
Atomic BEEF Transaction.toAtomicBEEF 1.47 ms 1.47 ms +0.00 ms 0.00%
Atomic BEEF Transaction.fromAtomicBEEF 3.59 ms 3.60 ms -0.01 ms -0.28%

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.

2 participants