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

Chap. 5 p101 : When transaction cache is hit the testnet field of the cached tx is assigned again #290

Open
salmonberry7 opened this issue Jan 2, 2025 · 0 comments

Comments

@salmonberry7
Copy link

salmonberry7 commented Jan 2, 2025

In the class method fetch of class TxFetcher the line cls.cache[tx_id].testnet = testnet appears outside of the preceding if branch causing an unnecessary reassignment of the field testnet of the transaction when there has been a cache hit (ie. when both fresh and tx_id not in cls.cache equal False). This assignment should only be made if we are entering a new transaction into the cache (ie. a cache miss) or refreshing an existing transaction in the cache due to the fresh parameter being True - ie. when we enter the if branch. Thus the line cls.cache[tx_id].testnet = testnet should be indented one tab to appear within the if branch. This bug does not cause the code to malfunction but fixing it would clarify the code for reading.

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

No branches or pull requests

1 participant