Skip to content

fix: include pending transactions in agent wallet spend limit check#33

Open
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/agent-spend-limit-race-condition
Open

fix: include pending transactions in agent wallet spend limit check#33
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/agent-spend-limit-race-condition

Conversation

@0x-SquidSol
Copy link
Copy Markdown

Summary

  • The daily spend limit query only counted status = 'confirmed' transactions
  • Concurrent transfers could bypass the 2 SOL agent wallet limit because pending transactions were invisible to the check
  • Now counts both confirmed and pending transactions toward the daily limit

Test plan

  • Submit concurrent agent transfers that total over 2 SOL — verify the limit is enforced
  • Verify failed transactions are not counted toward the limit
  • Run pnpm run typecheck — passes clean
  • Run pnpm run test — all wallet tests pass (19/19)

The daily spend limit query only counted confirmed transactions,
allowing concurrent transfers to bypass the 2 SOL limit. Pending
transactions are now included in the sum so in-flight transfers are
accounted for before new ones are authorized.

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

1 participant