Skip to content

Remove transaction ID maps#261

Merged
n8mgr merged 7 commits intomasterfrom
christopher/clean-up-indexing-more
Jul 10, 2025
Merged

Remove transaction ID maps#261
n8mgr merged 7 commits intomasterfrom
christopher/clean-up-indexing-more

Conversation

@chris124567
Copy link
Copy Markdown
Member

@chris124567 chris124567 commented Jul 7, 2025

Finish #208 and remove the remaining maps that we used to map Sia IDs to internal database IDs.

christopher/clean-up-indexing-more:

----- latest commit (8946...) -----
BenchmarkApplyRevert/apply-4                 276       4194136 ns/op
BenchmarkApplyRevert/revert-4                 34      33399087 ns/op

master:

BenchmarkApplyRevert/apply-4                 248       4679242 ns/op
BenchmarkApplyRevert/revert-4                 33      33931566 ns/op

@github-project-automation github-project-automation bot moved this to In Progress in Sia Jul 7, 2025
@n8mgr n8mgr requested a review from peterjan July 10, 2025 04:25
Copy link
Copy Markdown
Member

@n8mgr n8mgr left a comment

Choose a reason for hiding this comment

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

Lots of duplicated work here. Calling txn.ID() and getTransactionID() in every function is unnecessary.

Most of these methods only use the transaction to calculate the ID and access the slice. Instead of passing the transaction, you can pass exactly what you need:

func addMinerFees(tx *txn, txnID int64, []types.Currency)
func addSiacoinInputs(tx *txn, txnID int64, []types.SiacoinInput)

For the ones that need the transaction data to derive an ID, you should still pass the txn, but I'd recommend passing in the db ID as an additional arg instead of grabbing it. Goes for the V2 code as well.

@chris124567 chris124567 requested a review from n8mgr July 10, 2025 13:45
@n8mgr n8mgr merged commit af67b5b into master Jul 10, 2025
7 of 35 checks passed
@n8mgr n8mgr deleted the christopher/clean-up-indexing-more branch July 10, 2025 20:29
@github-project-automation github-project-automation bot moved this from In Progress to Done in Sia Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants