Skip to content

fix: wrap setDefaultWallet in database transaction#36

Closed
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/set-default-wallet-transaction
Closed

fix: wrap setDefaultWallet in database transaction#36
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/set-default-wallet-transaction

Conversation

@0x-SquidSol
Copy link
Copy Markdown

Summary

  • setDefaultWallet ran two UPDATEs (clear all defaults, set new default) without a transaction
  • Concurrent calls could leave the database with zero or multiple default wallets
  • Both UPDATEs now execute atomically via db.transaction()

Test plan

  • Switch default wallet — verify exactly one wallet has is_default = 1
  • Run pnpm run typecheck — passes clean
  • Run pnpm run test — all wallet tests pass (19/19)

The two UPDATE statements (clear all defaults, set new default) ran
without a transaction. A concurrent call between them could leave zero
or multiple wallets marked as default. Both updates now execute
atomically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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