]> Untitled Git - bdk/commit
fix(esplora): stop paging when the server does not advance the cursor
authorluhrhenz <anoitinglawrence@gmail.com>
Fri, 9 Oct 2026 14:43:14 +0000 (15:43 +0100)
committer志宇 <hello@evanlinjin.me>
Sun, 18 Oct 2026 09:47:25 +0000 (20:47 +1100)
commit19ba4e3d67516e4a3045b9870ccf7bfd6173579e
tree3ac1fcc18fec1a26b501770b3d770f87b7c45b79
parent7f7f653b760f083b98beb94a5aaaa047f2c0288c
fix(esplora): stop paging when the server does not advance the cursor

The per-script-pubkey pagination loop paged forward by asking for the
transactions following the last txid of the previous page, but never
checked that the cursor moved. A server that answers every request with
the same full page of 25 transactions kept the cursor in place, so the
loop re-requested that page forever while appending to an unbounded
`Vec`, and `sync`/`full_scan` never returned.

Track every cursor paged from, and return `InvalidResponse` if a full
page ends on one we have already seen. This catches a cursor that repeats
straight away as well as one that cycles (`A -> B -> A`). Erroring rather
than breaking avoids silently handing the caller a truncated transaction
history, which is how `chain_update` already treats a server it cannot
reconcile with.

Closes #2339
crates/esplora/Cargo.toml
crates/esplora/src/async_ext.rs
crates/esplora/src/blocking_ext.rs
crates/esplora/tests/async_ext.rs
crates/esplora/tests/blocking_ext.rs
crates/esplora/tests/common/mod.rs