You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
The logic correctly detects double-spends when two competing transactions attempt to spend the same UTXO within a single batch. The implementation properly distinguishes between idempotent re-spends (same spending data) and actual double-spends (different spending data).
Key Changes:
Enhanced deduplication logic to check spending data, not just UTXO keys
Double-spend attempts are immediately rejected with UtxoSpentError
Idempotent duplicates continue to succeed as expected
First-arrival-wins policy is correctly enforced
Analysis:
The fix addresses a scenario where the old code would silently allow a double-spend if both competing transactions were processed in the same batch. The new code at sql.go:2041-2050 compares spending data and raises an error for the second transaction when data differs.
Observations:
Logic correctness: Verified through multiple scenarios including edge cases with 3+ competing entries
Error handling: Proper fallback to ProcessingError if spending data parse fails
Success propagation: Line 2295 correctly uses bytes.Equal check to avoid marking double-spends as successful
No tests added: The PR modifies critical double-spend detection logic but does not include new tests
Per AGENTS.md guidelines, tests should accompany changes to core validation logic, especially for security-critical paths like double-spend detection.
sugh01
deleted the
test/adversarial-double-spend-coverage-fix-ds-logic
branch
May 7, 2026 11:01
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
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.
No description provided.