[Bug] .watch() can hang when RPC block num is stale
- Lingua principale
- Rust
- Stelle
- 1.3k
- Fork
- 668
- Merge medio
- 2g 1h
- PR unite (30g)
- 29
Descrizione
### 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.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.