[Bug] .watch() can hang when RPC block num is stale
- Langage dominant
- Rust
- Étoiles
- 1.3k
- Forks
- 668
- Merge moyen
- 2 j 2 h
- PR mergées (30 j)
- 29
Description
### Component
provider, pubsub
### What version of Alloy are you on?
1.7.3
### Operating System
macOS (Apple Silicon)
### Describe the bug
I've noticed that watch() on an http provider can hang for long times || indefinitely when the underlying RPC nodes have stale block nums (i.e. returned by `eth_blockNumber`).
This isn't that uncommon with node providers like Alchemy due to the way they seem to do routing.
The issue is that the way `watch_pending_transactions()` works with an http provider seems to be to get the latest block number, then iterate (via `NewBlocks`) through recent blocks, checking for existing of the tx being watched in each. As polling/processing time gets close to block time, this can hang for a long time, sometimes even indefinitely!
I've moved away from using `watch()` in favor of just locally looping `eth_getTransactionReciept`, but it might be worth doing the dumb thing of that and/or documenting on `watch()` that this inconsistency exists.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.