Skip to content

Implement Database Transactions for Savings History #405

Description

@codeZe-us

To prevent data corruption or inconsistencies between the local database and the Stellar blockchain, deposits and withdrawals must be processed within strict ACID transactions.

Implementation guidelines:

  • Use Drizzle ORM's db.transaction() wrapper in backend services that write savings data.
  • When recording a successful deposit or withdrawal, lock the user's ledger status, insert the transaction history entry, and update the cached savings balance in a single transactional block.
  • Roll back the transaction if any of the operations fail or if a conflict is detected.

Files location: backend/src/server/actions.ts, defindex_service.ts

Expected result: Database operations for savings transfers are executed safely, preventing race conditions or partial writes in the database.

Join the contributor Telegram group and ask any questions: https://t.me/+8mSQnieRmIM1Yjc0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions