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.
The function now looks like this:
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.