DefiantLabs / cosmos-tax-cli

An opensource cosmos tax tool!
https://defiantlabs.net
Apache License 2.0
25 stars 7 forks source link

Do data delete and recreate during reindex instead of create or update #472

Open pharr117 opened 1 year ago

pharr117 commented 1 year ago

We do create or update operations on the TaxableTransaction data type:

https://github.com/DefiantLabs/cosmos-indexer/blob/8ce9576bb5f4bd837c1359d4eede52da48fbb42f/db/db.go#L283-L309

The problem is highlighted in the comment at the top of the code "Keying off of msg ID and amount may be sufficient....". This will not be sufficient during reindex operations. If the reindex is happening due to a bug in amount handlers such that a message returns a different amount, this will lead to data duplication.