alloy-rs / alloy-rs/alloy

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

Open
#3,408 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
1.3k
Forks
668
Avg merge
2d 2h
Merged PRs (30d)
29

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.