Skip to content

fix: use transaction blockhash for Jupiter swap confirmation#31

Closed
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/swap-blockhash-confirmation
Closed

fix: use transaction blockhash for Jupiter swap confirmation#31
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/swap-blockhash-confirmation

Conversation

@0x-SquidSol
Copy link
Copy Markdown

Summary

  • Swap confirmation was fetching a new blockhash after sending instead of using the one Jupiter embedded in the transaction
  • This blockhash mismatch could cause confirmation to fail or report incorrect status, even when the swap succeeded on-chain
  • Now extracts transaction.message.recentBlockhash from the deserialized transaction for confirmation

Test plan

  • Execute a Jupiter swap and verify confirmation completes correctly
  • Verify transaction status is recorded as 'confirmed' in history
  • Run pnpm run typecheck — passes clean
  • Run pnpm run test — all wallet tests pass (19/19)

The swap confirmation was fetching a new blockhash after sending the
transaction instead of using the one embedded by Jupiter. This mismatch
could cause confirmation failures or incorrect transaction status even
when the swap succeeded on-chain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@nullxnothing nullxnothing left a comment

Choose a reason for hiding this comment

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

This still mixes confirmation data from two different blockhash contexts. The patch switches �lockhash to ransaction.message.recentBlockhash, but lastValidBlockHeight is still fetched from a fresh getLatestBlockhash() call after send. Those values need to come from the same context; otherwise confirmTransaction can still report the wrong status or timeout if the chain advances between calls.

@nullxnothing
Copy link
Copy Markdown
Owner

Closed as superseded by #75, which reapplies the corrected security hardening on top of current main. This avoids merging stale/conflicted branches and preserves the fixes with passing CI/CodeQL.

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