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 the thread-safety issue in the prune_old_batches function. #45

Open
mchitgarha78 opened this issue Aug 15, 2024 · 0 comments
Open

Comments

@mchitgarha78
Copy link
Collaborator

The function now looks like this:

def prune_old_batches(self, app_name: str, remove_border: int) -> None:
        """Helper function to prune old batches from memory."""
        self.apps[app_name]["batches"] = {
            batch["hash"]: batch
            for batch in self.apps[app_name]["batches"].values()
            if batch["state"] != "finalized" or batch["index"] > remove_border
        }

The issue lies in the assignment to self.apps[app_name]["batches"], as routes of the node may want to initialize some batches of transactions and append them to the dictionary using the batch hash as the key.

mchitgarha78 added a commit that referenced this issue Aug 15, 2024
abramsymons added a commit that referenced this issue Aug 23, 2024
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