Skip to content

feat(graph): detect negative-weight edges in PaymentGraphChecker (#773) - #823

Open
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/graph-negative-weight-773
Open

feat(graph): detect negative-weight edges in PaymentGraphChecker (#773)#823
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/graph-negative-weight-773

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown

Prevents unbounded fund extraction by rejecting payment graphs with negative recipient amounts before path-finding begins.

Changes

  • New GraphValidationError class for graph-level validation failures
  • check() now scans all recipient amounts before calling findPath
  • Throws GraphValidationError naming source, target, and negative amount
  • Zero-weight edges remain allowed (pass-through hops)
  • Tests: test/paymentGraphNegativeWeight.test.ts covers negative amount, error message shape, and valid graphs

Closes #773

…llar-split#773)

- Add GraphValidationError for graph-level validation failures
- check() now validates all recipient amounts before path-finding
- Throws GraphValidationError naming source, target, and amount
- Zero-weight edges remain allowed
- Add unit tests for negative amount, error message, and valid graphs

Closes Stellar-split#773
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.

Detect negative-weight edges in the payment graph checker

1 participant