Skip to content

feat(core)!: Make last_active_indices a Vec<(K, u32)> - #2315

Draft
evanlinjin wants to merge 1 commit into
bitcoindevkit:masterfrom
evanlinjin:feat/last-active-indices-vec
Draft

evanlinjin wants to merge 1 commit into
bitcoindevkit:masterfrom
evanlinjin:feat/last-active-indices-vec

Conversation

@evanlinjin

Copy link
Copy Markdown
Member

Description

Fixes #2314.

FullScanResponse::last_active_indices is now a Vec<(K, u32)> instead of a
BTreeMap<K, u32>, and KeychainTxOutIndex::reveal_to_target_multi takes
impl IntoIterator<Item = (K, u32)> instead of &BTreeMap<K, u32>.

A chain source learns of activity one spk at a time, in arbitrary order, so a
map forces every producer to keep a running per-keychain max before it can
report (a plain insert there silently under-reports the last active index).
The consumer never needed a map: _reveal_to_target only reveals upwards, so
unordered and repeated entries are already handled correctly. Merging two
responses is now a concatenation instead of a per-key max.

Notes to the reviewers

The esplora and electrum producers now push each observation as they make it.
Both still emit at most one entry per keychain, so the tests assert on the exact
Vec.

Changelog notice

  • Breaking: FullScanResponse::last_active_indices is now Vec<(K, u32)>.
  • Breaking: KeychainTxOutIndex::reveal_to_target_multi now takes
    impl IntoIterator<Item = (K, u32)>.

Checklists

All Submissions:

Bugfixes:

  • This pull request breaks the existing API
  • I'm linking the issue being fixed by this PR

🤖 Generated with Claude Code

https://claude.ai/code/session_01VATvTCqPsmqxZuvzm7WZ9s

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.85%. Comparing base (c6a6073) to head (3a6795e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2315      +/-   ##
==========================================
+ Coverage   78.84%   78.85%   +0.01%     
==========================================
  Files          31       31              
  Lines        6060     6063       +3     
  Branches      288      288              
==========================================
+ Hits         4778     4781       +3     
  Misses       1203     1203              
  Partials       79       79              
Flag Coverage Δ
rust 78.85% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@evanlinjin
evanlinjin force-pushed the feat/last-active-indices-vec branch from d232bfb to 995ee2e Compare September 16, 2026 06:57
`FullScanResponse::last_active_indices` was a `BTreeMap<K, u32>`, which forced
every producer to keep a running per-keychain max before reporting, since a
chain source learns of activity one spk at a time in arbitrary order. Producers
now push each observation as they make it, and merging two responses is a
concatenation.

`KeychainTxOutIndex::reveal_to_target_multi` now takes
`impl IntoIterator<Item = (K, u32)>`. It only ever reveals upwards, so
unordered and repeated entries are already handled correctly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VATvTCqPsmqxZuvzm7WZ9s
@evanlinjin
evanlinjin force-pushed the feat/last-active-indices-vec branch from 995ee2e to 3a6795e Compare September 16, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

FullScanResponse::last_active_indices should be a Vec<(K, u32)>

1 participant