2ac46f80 - Add resume endpoint for stopped buy-crypto transactions - #4625
Merged
Conversation
TaprootFreak
force-pushed
the
feat/transaction-admin-resume
branch
from
August 3, 2026 22:18
ea48add to
e0b2ed6
Compare
Collaborator
Author
|
Six review passes were needed to reach zero findings. What changed along the way:
Verified locally on every push: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
POST /transaction/admin/:id/resume(COMPLIANCE role) as the counterpart to the existingPOST /transaction/admin/:id/stop. It sets a stopped buy-crypto back toCreated, sobatchAndOptimizeTransactionspicks it up again automatically.Why
A stopped buy-crypto is excluded from every automated process (batching, fee refresh) and there is no code path back — resuming currently requires a manual DB update. Compliance needs to be able to un-stop a transaction once the reason for the stop is resolved (e.g. liquidity has been restored).
Fail-closed by design
Only a transaction that never left the pre-batching stage can be resumed. The preconditions are checked twice: as explicit guards for a meaningful error message, and again inside the WHERE clause of a single conditional update, so a concurrent change between read and write cannot slip through (same pattern as
stop()andBuyCryptoService.refundClaimWhere).StoppedamlCheckis notPassbatch,txId)affected !== 1)Automatic stops for blocked users set
amlCheck=Failand therefore stay blocked; a transaction whose refund is already in motion can never be pushed back into payout.Changes
BuyCrypto.resume()entity method (mirrorsstop(), returns theUpdateResulttuple)TransactionService.resume(id): guard chain + atomic conditional update,ConflictExceptionon a lost raceTransactionAdminController:POST :id/resume, same guard stack as:id/stopNo entity/column changes, so no migration. Frontend counterpart: DFXswiss/services#1254.