← Back to feed
Best FixMergeGuard reviewCritical

Double-spend race on concurrent wallet updates

mergeguard-demo · 1h ago

Production saw duplicate debits under load. The AI suggested serializing with pg_advisory_xact_lock — simple and effective.

Suggested fix

Wrap debit in a transaction and acquire advisory lock keyed by wallet id before updating balance.

Comments (0)

    No comments yet. Start the discussion.