Skip to content

feat: adopt the FiltersMan node (compact-filter headers only) - #162

Merged
jvsena42 merged 4 commits into
mainfrom
feat/filters-man
Sep 20, 2026
Merged

jvsena42 merged 4 commits into
mainfrom
feat/filters-man

Conversation

@jvsena42

@jvsena42 jvsena42 commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Close #53 — app side of the FiltersMan port.

Node stack (merged): jvsena42/Floresta-mandacaru#29–#34, #36–#40 · FFI: jvsena42/floresta-mandacaru-ffi#34

The node now persists only the compact-filter header chain (~58 MB on mainnet instead of 13+ GB) and downloads full filters on demand for each rescan. It also deletes the legacy cfilters* files on first start, which is what gives already-synced devices their space back. The RPC contract the app relies on was deliberately kept, so the app change is small:

  • Filter progress is measured from genesis. Filter headers always sync from genesis and getblockchaininfo no longer reports filters_start. The wallet birthday still goes to the daemon as filtersStartHeight; there it now bounds rescans instead of the stored filter range.
  • No second rescan after loading a descriptor. loaddescriptor now rescans up to the tip by itself (it waits for the filter headers, and a descriptor loaded while another rescan runs gets a follow-up pass). The extra rescanblockchain armed via WALLET_NEEDS_RESCAN used to be a cheap local scan; with filters fetched from peers it would download the whole birthday→tip range twice. A birthday change still arms it.
  • rescan_blocks_processed/total now count scanned blocks of the range rather than matched blocks; the existing x/y UI works as is.

Bindings

Rebuilt with update-bindings.sh from jvsena42/floresta-mandacaru-ffi#34 (2ac3bb1), which pins floresta-node at Floresta-mandacaru master ec12000 (the merged FiltersMan stack). arm64-v8a keeps the 16 KB page alignment. That PR is merged (FFI master ddfe658), and its Cargo.lock, Cargo.toml and src are identical to the commit these binaries were built from.

Verification

  • ./gradlew testDebugUnitTest detekt lintDebug assembleDebug pass.
  • Mainnet on the Medium_Phone emulator (x86_64), upgrading an install of 0.15.0 that still had the old filter store:
    • the legacy cfilters, cfilters-index and cfilters-start-height files were removed on first start and cfilter_headers.dat created;
    • filter headers synced from genesis in ~20 min (~800 headers/s) and survived app restarts; the file is 62 MB at height 967,818 and the whole data dir 260 MB;
    • loading a descriptor ran the default rescan, birthday 822,375 → tip (145,444 blocks), in ~10 min with rescan_blocks_processed/total advancing; it downloaded ~3.1 GB of filters, found the funding and the spending transaction, and the Node screen ended at Sync 100%;
    • no warnings or errors in files/debug.log during the rescan.
  • With these final bindings on the emulator: the node runs on the existing data, and Share validation → Copy returns the accumulator of the moment (copied payload and getblockchaininfo agreed on height 967,886, 3,201,471,741 leaves and all 20 roots).
  • Not verified on a physical arm64 device.

User-visible trade-off

Rescans cost bandwidth now instead of disk: roughly the size of the filters between the wallet birthday and the tip (on the order of 1 GB per year of mainnet history), each time. Worth surfacing near the birthday picker / Rescan button in a follow-up.

🤖 Generated with Claude Code

jvsena42 and others added 4 commits September 20, 2026 15:58
The node now keeps only the compact-filter header chain, which always
syncs from genesis, and `getblockchaininfo` no longer reports
`filters_start`. The wallet birthday still reaches the daemon as
`filtersStartHeight`, where it bounds rescans instead of the stored
filter range.

Refs #53

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`loaddescriptor` now rescans up to the tip by itself: it waits for the
filter headers, and a descriptor loaded while another rescan runs gets a
follow-up pass. The extra `rescanblockchain` armed here used to be a
cheap scan of the local filter store; with filters fetched from peers it
would download the whole birthday..tip range a second time.

A wallet-birthday change still arms it, since the node only applies the
new birthday to later rescans.

Refs #53

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The field is gone from the getblockchaininfo response model.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
floresta-mandacaru-ffi `feat/filters-man` with floresta-node at
Floresta-mandacaru master `ec12000`. arm64-v8a keeps the 16 KB page
alignment; x86_64 stays at 4 KB.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review September 20, 2026 19:30
@jvsena42
jvsena42 enabled auto-merge (rebase) September 20, 2026 19:46
@jvsena42
jvsena42 merged commit 8fcfbca into main Sep 20, 2026
3 of 4 checks passed
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.

Compact filters blow data dir from ~200 MB to 13+ GB post-IBD

1 participant