-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix assets
SQL table unique constrinat
#691
Comments
I had started writing an issue for these needs. Feel free to edit or lift any relevant elements. Issue title:Test duplicate address receive flow + DB uniqueness Description:This test will ensure that if a client tries to send to two duplicate addresses (say in the same transfer), that the daemon throw an error, we'll want to note if it gets clobbered in an internal map. It's important to make sure this is tested to avoid any potential issues with transactions being processed incorrectly. The unit tests should cover the scenarios:
|
Fixes #691 by adding a unique constraint that will actually work. The assumption of the constraint is that there will never be an asset of the same asset ID with the same script key in the same anchor transaction output. This would be impossible anyway because the asset leaves would collide within the asset-level MS-SMT tree. So this unique key is safe to use as an upsert detection mechanism.
Fixes #691 by adding a unique constraint that will actually work. The assumption of the constraint is that there will never be an asset of the same asset ID with the same script key in the same anchor transaction output. This would be impossible anyway because the asset leaves would collide within the asset-level MS-SMT tree. So this unique key is safe to use as an upsert detection mechanism.
Fixes #691 by adding a unique constraint that will actually work. The assumption of the constraint is that there will never be an asset of the same asset ID with the same script key in the same anchor transaction output. This would be impossible anyway because the asset leaves would collide within the asset-level MS-SMT tree. So this unique key is safe to use as an upsert detection mechanism.
Removing the old constraint is still an open issue #967 |
The
assets
SQL table's unique constraint is ineffective (it's a no-op). It doesn't do what we intend it to do.The current unique constraint is on the fields:
but
asset_id
is the table's primary key integer and not the asset ID byte array. This means that each row is unique and that duplicate assets can be inserted into the table.We add a unique constraint index with the following fields to the table:
With this new constraint we should not be able to add duplicate assets into the table.
Adding the new constraint will mean deleting rows from the
assets
table which violate this new constraint.Another change that follows naturally from this modification is to change the
InsertNewAsset
SQL statement into an upsert.This issue has caused this bug #665 but another solution has now addressed that bug.
PR #684 is an attempt at fixing this issue.
The text was updated successfully, but these errors were encountered: