Repository navigation
blindbit-lib: remove dead scanner API and P2P leftovers (SNB-663) - #44
Closed
setavenger wants to merge 1 commit into
Closed
setavenger wants to merge 1 commit into
setavenger wants to merge 1 commit into
Conversation
Remove public items nothing calls, in this workspace or in the other repos that use blindbit-lib (blindbit-node-apps, testkit, the talk benchmark): - broadcast_tx: its only caller, friglet's Electrum broadcast, uses friglet's own relay since #26. - Scanner::from_config, get_last_scanned_block_height_rescan, staged_mut, take_staged and the commented-out get_outputs. - watch_chain: friglet calls watch_chain_until; its doc moves there. - BlockIdentifierDisplay (only .0.block_height was read), OwnedOutput (never built), ProbableMatch::new, _match_short_pubkey_bytes and the commented-out ScannerConfig Default. electrum_index becomes a private module; its items stay re-exported. - The spent-outpoint and probabilistic-match channels and the code that only fed them. They had no subscribers and never sent anything: the sends were guarded by Sender::is_empty(), which means "no queued value", so they were always skipped. The malformed-hash branch that guarded them cannot run: check_block_identifier rejects such a block before scan_short_block_data sees it. The "possible spend of owned output" log line stays. - save_to_file's back-fill of keys and max_label_num: stage holds them from construction on and only take_staged could clear them. A test run with assertions in place of the back-fill passed every workspace test. - P2P: TimeoutParams setters the handshake never reads (it only uses the ping interval; the socket timeouts are set directly), history notes about deleted code, and a retry doc that predates the witness-stripped and bad-block retries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 3, 2026
Owner
Author
|
Merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: SNB-663
Net: 62 insertions, 383 deletions (−321 lines), all in
blindbit-lib/src/scanner/.What was removed and why it was dead
I searched for every item in this workspace and in the other repos that use blindbit-lib (blindbit-node-apps, blindbit-testkit, blindbit-desktop, and the talk benchmark
rust_scan_bench). None of them uses any of these items.broadcast_tx(p2p.rs) and its re-export. Its only caller was friglet's Electrum broadcast, which has used friglet's own relay since fix(friglet): real tip headers, honest broadcast, honest fee answers #26.Scanner::from_config,get_last_scanned_block_height_rescan,staged_mut,take_staged, and the commented-outget_outputs.watch_chain: friglet callswatch_chain_until. Its doc text moved towatch_chain_until, and comments that namedwatch_chainnow namewatch_chain_until.BlockIdentifierDisplay(only.0.block_heightwas ever read; the debug line now logsheightdirectly),OwnedOutput(never built),ProbableMatch::new(replaced by a struct literal),_match_short_pubkey_bytes, and the commented-outScannerConfigDefault.pub mod electrum_indexis now private. Everything friglet uses from it is still re-exported fromscanner.subscribe_to_spent_outpoints,subscribe_to_probabilistic_matches, their fields and senders), and the code that only fed them:if sender.is_empty() { continue }.is_empty()means "no queued value", so the send was always skipped.scan_short_block_dataonly existed to guard those sends, and it cannot run.check_block_identifierrejects any block whose hash is not 32 bytes beforescan_short_block_datais called, and the test helpers that call it directly always pass a real hash. The spent-output prefix check therefore now runs unconditionally, which is what already happened in every reachable case.save_to_fileback-filling the keys andmax_label_num(done only because the item was proven):stagegets both keys andmax_label_numinnewand infrom_changeset.ChangeSet::mergenever clears them, and onlytake_stagedcould replacestagewith an empty one.max_label_num != 0 || label_lookup.len() <= 1) and rancargo test --workspace. All 254 tests passed, and no assertion fired. Those tests cover fresh scanners, restores from the old-format fixture, reorg rollbacks and friglet's own saves.p2p.rs:TimeoutParamsread/write setters: bitcoin-p2p'shandshake(rev 322c4ab,src/net.rs) reads onlyping_intervalfromTimeoutParams. The socket read/write timeouts were already set directly on the stream, so the handshake now getsTimeoutParams::default(), which has the same ping interval.fetchretry doc listed only connect/closed/broken as retried. It now points atFetchFailure::is_transient, which also retries a witness-stripped or bad block (added in fix(scanner): fetch witness blocks so Sparrow gets whole transactions (SNB-657, stacked on #35) #36).Why behaviour is unchanged
No code path that runs today changes. The removed items have no callers. The removed sends never fired, and the removed branch could not be reached. The back-fill never did anything; the assertion run above shows that. The handshake gets the same parameters it actually read. Log strings friglet-ui matches are untouched, and so are
Scanner::new,scan_transaction_shortandOracleServiceClient::new(the talk benchmark uses them).Verification
cargo check --workspace --all-targets --all-features→ 0 warnings (baseline 0).cargo check -p blindbit-lib --no-default-features --all-targets→ 5 warnings (baseline 5, the same ones inload.rs).cargo clippy --no-deps -p friglet -p friglet-ipc -p friglet-tray --all-targets -- -D warnings→ clean.cargo fmt -p friglet -p friglet-ipc -p friglet-tray -- --check→ clean. blindbit-lib edits are formatted by hand to match the surrounding code.cargo test --workspace→ 254 passed, 1 ignored, 0 failed (baseline is the same; no test removed).Deliberately left out
ChangeSet,STATE_FORMAT_VERSION,REORG_LOOKBACK,ReorgTooDeepandOwnedOutputRecord(the issue'smod.rs:36,46,48). They are not unused:load.rsand the tests use them through these paths.staged(),from_changeset,load_from_file,owned_outputs(), andscan_block_rangedocumentsReorgTooDeepas its error. Dropping the names would leave callers unable to name or downcast them.pubthat is only visibility noise as not planned.BlockIdentifierDisplay,OwnedOutput,broadcast_tx) are removed.todoinscan_short_block_databelongs to SNB-669 (scan-loop comments) and is left for that PR.