Skip to content

fix(store): write transaction scripts atomically - #219

Open
skyc1e wants to merge 1 commit into
0xMiden:mainfrom
skyc1e:fix/atomic-transaction-record
Open

fix(store): write transaction scripts atomically#219
skyc1e wants to merge 1 commit into
0xMiden:mainfrom
skyc1e:fix/atomic-transaction-record

Conversation

@skyc1e

@skyc1e skyc1e commented Jun 30, 2026

Copy link
Copy Markdown

Fixes #216.

upsert_transaction_record wrote the transaction script and transaction record through separate IndexedDB promises. If the record write failed after the script insert, the script could remain in transactionScripts without any transaction referencing it.

This adds a small JS wrapper that writes both pieces inside one Dexie transaction and switches the Rust wasm binding to call that wrapper. The lower-level helpers stay in place for existing callers.

Checked with:

  • cmd /c ..\..\..\node_modules\.bin\vitest.cmd run --config vitest.config.ts ts/transactions.test.ts
  • cmd /c ..\..\..\node_modules\.bin\tsc.cmd --noEmit --project tsconfig.json
  • git diff --check

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.

upsert_transaction_record script insert and record upsert are separate transactions, can orphan script data

1 participant