Skip to content

wollet: fetch address histories concurrently - #175

Open
dadafros wants to merge 1 commit into
Blockstream:masterfrom
dadafros:concurrent-address-histories
Open

wollet: fetch address histories concurrently#175
dadafros wants to merge 1 commit into
Blockstream:masterfrom
dadafros:concurrent-address-histories

Conversation

@dadafros

@dadafros dadafros commented Aug 5, 2026

Copy link
Copy Markdown

Follow-up to #169: the pagination half is superseded by f450cb3/94a57422, so per the closing invitation this brings back only the concurrency half, rebased on top of them.

get_scripts_history_esplora awaited one request per address sequentially; it now drives the batch through an ordered buffered stream honoring EsploraClientBuilder::concurrency. Default stays 1, so behavior is unchanged unless opted in.

One non-obvious bit: the per-address futures are instantiated eagerly (they stay inert until polled) — holding an &Address-borrowing closure in the stream trips rust-lang/rust#89976 when an async_trait consumer like lwk_boltz must prove the future Send.

The paging e2e (test_esplora_address_history_paging) now runs at concurrency(4), so it also exercises the concurrent walk.

The address walk of the esplora full scan awaits one history request
per address sequentially, so wall-clock grows linearly with the number
of scanned addresses even though EsploraClientBuilder::concurrency
already parallelizes transaction and header downloads. Drive the same
batch through an ordered buffered stream honoring the configured
concurrency: buffered (not buffer_unordered) because callers map
results back to derivation indices positionally, and try_collect to
stop at the first error like the sequential loop does.

The per-address futures are instantiated eagerly (they stay inert
until polled; buffered still caps concurrent polling): holding an
&Address-borrowing closure inside the stream trips rustc's
higher-ranked FnOnce limitation (rust-lang/rust#89976) as soon as a
downstream async_trait consumer such as lwk_boltz must prove the
resulting future Send.

Default concurrency stays 1, so behavior is unchanged unless opted in.
@dadafros
dadafros force-pushed the concurrent-address-histories branch from 7ab2a4e to d976f00 Compare August 5, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant