alloy-rs / alloy-rs/alloy

[Bug] `watch_pending_transaction` will never pause heartbeat if transaction is missed due to reorg when calling `get_receipt`

Aperta
#3,408 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
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.1.1

### Operating System

Linux

### Describe the bug

Here's an example where the block was missed on arbitrum:

```
2025-12-22T23:56:36.636352Z DEBUG alloy_provider::blocks: yielding block number=413480103
2025-12-22T23:56:36.636359Z DEBUG alloy_provider::heart: handling block block_height=413480103
2025-12-22T23:56:36.947322Z DEBUG alloy_provider::heart: watching tx=0xa957513e3bae1cd9187e65c00bfa33e15d9b3ebb99f96c4c735cd51aaf4e6c75
2025-12-22T23:56:36.947360Z DEBUG alloy_provider::heart: updating heartbeat pause state paused=false
2025-12-22T23:56:38.502948Z DEBUG alloy_provider::blocks: fetching block number=413480111
2025-12-22T23:56:38.522697Z DEBUG alloy_provider::blocks: fetching block number=413480112
2025-12-22T23:56:38.541916Z DEBUG alloy_provider::blocks: yielding block number=413480111
2025-12-22T23:56:38.541927Z DEBUG alloy_provider::heart: handling block block_height=413480111
2025-12-22T23:56:38.541938Z DEBUG alloy_provider::heart: reorg/unpause detected block_height=413480111 last_height=413480103
2025-12-22T23:56:38.541986Z DEBUG alloy_provider::blocks: yielding block number=413480112
2025-12-22T23:56:38.541994Z DEBUG alloy_provider::heart: handling block block_height=413480112
```

The transaction I was waiting for a receipt for here was in `413480106` and it causes `watch_pending_transaction` to poll forever since the transaction is missed.


https://github.com/alloy-rs/alloy/blob/174b64362a61010f77f0ada7a4e47f2cd88a357c/crates/provider/src/heart.rs#L228

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.