Skip to content

fix: address validation for duplicate input/output addresses (issue #58)#489

Open
harrshita123 wants to merge 3 commits into
caravan-bitcoin:mainfrom
harrshita123:fix/build-errors-and-issue-58
Open

fix: address validation for duplicate input/output addresses (issue #58)#489
harrshita123 wants to merge 3 commits into
caravan-bitcoin:mainfrom
harrshita123:fix/build-errors-and-issue-58

Conversation

@harrshita123

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bugfix

Issue Number:

Fixes #58

Summary

Previously, address validation was only performed when an output was modified. This caused a sync issue: if an output was added first and a matching input was added later, the "duplicate address" error wouldn't show up because the reducer didn't re-validate the existing outputs against the new input list.

This PR centralizes validation into a validateOutputAddress helper and ensures that validateTransaction re-checks all current outputs every time inputs are updated.

Does this PR introduce a breaking change?
No

Checklist

  • I have tested my changes thoroughly.
  • I have added or updated tests to cover my changes (if applicable).
  • I have verified that test coverage meets or exceeds 95% (if applicable).
  • I have run the test suite locally, and all tests pass.
  • I have written tests for all new changes/features
  • I have followed the project's coding style and conventions.
  • I have created a changeset to document my changes (npm run changeset)

Other information

A new test file apps/coordinator/src/reducers/transactionReducer_repro.test.js was added to specifically verify the "output before input" scenario and prevent regressions.

Have you read the contributing guide?

Yes

@vercel

vercel Bot commented Feb 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
caravan-coordinator Ready Ready Preview, Comment May 20, 2026 3:40pm

Request Review

@changeset-bot

changeset-bot Bot commented Feb 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 23f5c35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
caravan-coordinator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 30 days and has been marked as stale. It will be closed in 7 days if no further activity occurs. To keep this PR open, add the "long-lived" label or comment on it.

@github-actions github-actions Bot added the stale label Apr 4, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed due to inactivity for 7 days after being marked as stale. Feel free to reopen if needed!

@github-actions github-actions Bot closed this Apr 11, 2026
@bucko13 bucko13 reopened this Apr 14, 2026
@bucko13 bucko13 removed the stale label Apr 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 30 days and has been marked as stale. It will be closed in 7 days if no further activity occurs. To keep this PR open, add the "long-lived" label or comment on it.

@github-actions github-actions Bot added the stale label May 15, 2026
@bucko13

bucko13 commented May 15, 2026

Copy link
Copy Markdown
Contributor

Will review soon

@Legend101Zz Legend101Zz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, just a small nit and one question of placing test in a seperate new file

Comment thread apps/coordinator/src/reducers/transactionReducer_repro.test.js Outdated
Comment thread apps/coordinator/src/reducers/transactionReducer.js Outdated
@Legend101Zz

Copy link
Copy Markdown
Contributor

Will review soon

Sorry 😅 I went ahead and did the initial review — hope that’s okay :)

@harrshita123

Copy link
Copy Markdown
Author

Will review soon

Sorry 😅 I went ahead and did the initial review — hope that’s okay :)

No worries 😄
Thanks for taking the time to do the initial review, I really appreciate it! I’ll go through the requested changes and update the PR soon.

@github-actions github-actions Bot removed the stale label May 16, 2026
@harrshita123

harrshita123 commented May 20, 2026

Copy link
Copy Markdown
Author

@Legend101Zz

Updated the PR with the requested fixes.

  • Removed the separate transactionReducer_repro.test.js file and kept the Bug: possible to construct a transaction with an output equal to an input #58 coverage in the existing transactionReducer.test.js suite.
  • Preserved blank-address validation for user-cleared output addresses while still keeping untouched empty outputs quiet during reducer revalidation.
  • Added a patch changeset for caravan-coordinator to satisfy the changeset check.
  • Fixed the Prettier indentation issue reported by CI.

Local checks run:

  • git diff --check
  • npx changeset status --since=origin/main
  • npm run lint --workspace=caravan-coordinator
  • npm run test --workspace=caravan-coordinator -- transactionReducer.test.js (19 passed)

@Legend101Zz Legend101Zz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM , thanks for the PR ..
@bucko13 can you do a final review when you get the chance :)

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 30 days and has been marked as stale. It will be closed in 7 days if no further activity occurs. To keep this PR open, add the "long-lived" label or comment on it.

@github-actions github-actions Bot added the stale label Jun 24, 2026
@harrshita123

Copy link
Copy Markdown
Author

@bucko13 Could you please review this pr .

@bucko13

bucko13 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Heads up @Shadouts @jpcummins

@github-actions github-actions Bot removed the stale label Jun 25, 2026
@harrshita123

Copy link
Copy Markdown
Author

@bucko13 Could you please review this pr .

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.

Bug: possible to construct a transaction with an output equal to an input

3 participants