Skip to content
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

Add v2 inputs #121

Merged
merged 4 commits into from
Oct 24, 2024
Merged

Add v2 inputs #121

merged 4 commits into from
Oct 24, 2024

Conversation

chris124567
Copy link
Member

  • Add v2 siacoin and siafund inputs
  • For v1 inputs, store a reference to the siacoin_elements or siafund_elements integer ID instead of the encoded parent ID
  • Fix bug with when inserting into siacoin and siafund elements tables. To get a mapping of element IDs to integer IDs in the database, we would use result.LastInsertId() in addSiacoinElements/addSiafundElements, which worked the first time an element was inserted, but not when it was updated to reflect spent status (it would return the latest ID in the table rather than the elements ID). This did not cause any issues until now because this would only occur when an element was spent (ie when the element was an input in that block), and for inputs we were storing the encoded parent ID rather than the numeric ID from the database, so the incorrectly mapped IDs were not used anywhere. Now we use RETURNING id at the end of the query so the ID reflects the element we actually want.

…g into siacoin_elements and siafund_elements to get correct id in cases where we update instead of insert
internal/testutil/check.go Outdated Show resolved Hide resolved
@chris124567 chris124567 merged commit 33f1cc4 into v2 Oct 24, 2024
8 checks passed
@chris124567 chris124567 deleted the add-v2-inputs branch October 24, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants