Skip to content

fix(exchange-tx): notify Scrypt deposit only after bank_tx confirms money left#3778

Merged
davidleomay merged 1 commit into
developfrom
fix/scrypt-deposit-cleanup-threshold
May 27, 2026
Merged

fix(exchange-tx): notify Scrypt deposit only after bank_tx confirms money left#3778
davidleomay merged 1 commit into
developfrom
fix/scrypt-deposit-cleanup-threshold

Conversation

@davidleomay
Copy link
Copy Markdown
Member

@davidleomay davidleomay commented May 27, 2026

Summary

  • Scrypt deposit requests were sent at bank payment transmission time, before the money actually arrived at Scrypt
  • Scrypt created pending deposits that could take >24h to reconcile (changes ClReqID on completion)
  • A cleanup cron marked them failed after 24h, racing against Scrypt's reconciliation
  • This caused ~100k CHF double-count in the financial log (unmatched bank_tx in pending.toScrypt + same amount in live balance)

Fix

  • Move the Scrypt deposit notification from the Yapeal/OlkyPay transmit step to searchOutgoingBankTx, where the matching bank_tx confirms the money left
  • Remove the cleanupStalePendingDeposits cron — no longer needed since deposits won't be created prematurely

Root cause investigation

  • Verified locally that Scrypt's fetchAll returns the completed deposit with Status: "Completed" but under a different ClReqID than the original pending record
  • Confirmed by setting a failed deposit back to pending in prod — the sync picked it up and resolved to ok within one cycle
  • The 24h cleanup was the only reason these deposits stayed failed

Test plan

  • CI green
  • After deploy: set remaining failed Scrypt deposits back to pending, verify they resolve to ok
  • Monitor totalBalanceChf in financial log — should drop by ~100k CHF

…oney left

Scrypt deposit requests were sent at bank payment transmission time, before
the money actually arrived. Scrypt then created pending deposits that could
take >24h to reconcile. A cleanup cron marked them failed after 24h, racing
against Scrypt's reconciliation and causing ~100k CHF double-count in the
financial log.

Move the Scrypt deposit notification from the transmit step to the
searchOutgoingBankTx completion step, where the matching bank_tx confirms
the money left. Remove the stale deposit cleanup cron — no longer needed.
@davidleomay davidleomay force-pushed the fix/scrypt-deposit-cleanup-threshold branch from c0ccefc to eef5b3c Compare May 27, 2026 13:15
@davidleomay davidleomay changed the title fix(exchange-tx): extend Scrypt deposit cleanup threshold to 7 days fix(exchange-tx): notify Scrypt deposit only after bank_tx confirms money left May 27, 2026
@davidleomay davidleomay merged commit 63b3cc1 into develop May 27, 2026
7 checks passed
@davidleomay davidleomay deleted the fix/scrypt-deposit-cleanup-threshold branch May 27, 2026 13:24
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.

2 participants