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

fix: increment TxCountByAddress once per tx #72

Merged
merged 1 commit into from Aug 30, 2022

Conversation

jmhrpr
Copy link
Member

@jmhrpr jmhrpr commented Aug 30, 2022

closes #71

TxCountByAddress now increments the tx counter once per tx for every address in the transaction inputs and outputs by maintaining a set of already-seen addresses while processing each transaction. For each address, if it is not included in the seen-addresses set then increment the counter and insert the address into the set.

I wasn't sure if I should build the set then iterate over each address to do the send, or to maybe build the prefix before trying the insert into the set to avoid the clone, but I think the current implementation was the best option.

@jmhrpr jmhrpr requested a review from scarmuega as a code owner August 30, 2022 13:09
@jmhrpr
Copy link
Member Author

jmhrpr commented Aug 30, 2022

It also tracks invalid transactions. I guess there's not really a definition on how you count invalid transactions. If we want to be extra-precise maybe for invalid transactions we check the collateral inputs and collateral outputs instead of the standard inputs and outputs.

@scarmuega scarmuega merged commit e702e5a into txpipe:main Aug 30, 2022
@jmhrpr jmhrpr deleted the fix/tx-count-by-address branch August 31, 2022 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: TxCountByAddress reducer incrementing multiple times per tx
2 participants