Skip to content

Ah/feat add token watcher mode#11

Merged
ahmedhamedaly merged 3 commits into
masterfrom
ah/feat-add-token-watcher-mode
Jan 5, 2026
Merged

Ah/feat add token watcher mode#11
ahmedhamedaly merged 3 commits into
masterfrom
ah/feat-add-token-watcher-mode

Conversation

@ahmedhamedaly

Copy link
Copy Markdown
Contributor

No description provided.

@ahmedhamedaly
ahmedhamedaly requested review from njelich and rube-de and removed request for njelich December 23, 2025 07:07
Comment thread Dockerfile
@ahmedhamedaly
ahmedhamedaly requested a review from njelich January 5, 2026 10:31
@ahmedhamedaly
ahmedhamedaly merged commit 5f55439 into master Jan 5, 2026
4 checks passed
@ahmedhamedaly
ahmedhamedaly deleted the ah/feat-add-token-watcher-mode branch January 5, 2026 12:30

@rube-de rube-de left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have tests with mock for the other modes, we should also have it for this mode.

Comment thread Dockerfile
except Exception as e:
logger.error(f"Error in token watcher: {e}", exc_info=True)

async def _check_block_for_token_transfers(self, block_number: int) -> bool:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see this called anywhere.
If this is some old function, I recommend to remove it.

to_remove = list(self.processed_tx_hashes)[
: self.max_tx_cache_size // 2
]
self.processed_tx_hashes -= set(to_remove)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set doesn't guarantee insertion order in python and you could remove a recent hash instead of the oldest
I would recommend to use dict with insertion-order keys.

Some unit tests for this case may be helpful

if start_block > latest_block_number:
return

end_block = min(start_block + 100, latest_block_number)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preferable not use magic numbers.
Many free RPCs also limit max blocks to 10, I would commend to have this configurable, as we have it with batch_size

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.

3 participants