Skip to content

Implemented a guard on POST /api/streams that rejects a near-duplicate stream — one with the same sender, recipient, asset, and amount created in the last 60 seconds — with a 409 DUPLICATE_STREAM response that includes the existing stream's ID, plus an X-Allow-Duplicate: true header to opt out. - #906

Open
DevScoopee wants to merge 1 commit into
ritik4ever:mainfrom
DevScoopee:main

Conversation

@DevScoopee

Copy link
Copy Markdown

This change adds findRecentDuplicate() to streamStore.ts, which looks up an identical active stream created within DUPLICATE_WINDOW_SECONDS (60), comparing amounts exactly and asset codes case-insensitively. The route handler in index.ts calls it before wrapping a stream and returns 409 with existingStreamId on a match, while honoring the X-Allow-Duplicate: true bypass; swagger.ts documents both the new header and the 409 shape.

Closes #720

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@DevScoopee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@DevScoopee is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ed7c27de-c415-466d-939b-5d956e6b1631


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…e stream — one with the same sender, recipient, asset, and amount created in the last 60 seconds — with a 409 DUPLICATE_STREAM response that includes the existing stream's ID, plus an X-Allow-Duplicate: true header to opt out.

This change adds findRecentDuplicate() to streamStore.ts, which looks up an identical active stream created within DUPLICATE_WINDOW_SECONDS (60), comparing amounts exactly and asset codes case-insensitively. The route handler in index.ts calls it before wrapping a stream and returns 409 with existingStreamId on a match, while honoring the X-Allow-Duplicate: true bypass; swagger.ts documents both the new header and the 409 shape.

Closes ritik4ever#720
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.

[FEATURE] Add duplicate stream detection

1 participant