Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4ea2e06
test: drive the BIP-352 vectors through the live short receive path (…
setavenger Sep 24, 2026
be4e8bb
fix: record owned outputs so spends are detected; persist labels
setavenger Sep 24, 2026
ad80ea4
test(scanner): pin how a range scan handles unscannable oracle stream…
setavenger Sep 24, 2026
27c1e90
fix(scanner): stop a range scan at an unscannable block instead of sk…
setavenger Sep 24, 2026
d5037c8
Merge remote-tracking branch 'origin/fix/cli-spent-and-labels' into f…
setavenger Sep 24, 2026
3ce1404
fix(scanner): detect chain reorganisations and roll back to the fork …
setavenger Sep 24, 2026
bcfa3a2
Merge branch 'snb-541-short-path-vectors' (#17) into fix/cli-spent-an…
setavenger Oct 1, 2026
22c50bf
fix(scanner): start at the oracle's first block when the wallet start…
setavenger Oct 1, 2026
1dbe74c
Merge branch 'fix/stream-unindexed-height' (#20) into fix/cli-spent-a…
setavenger Oct 1, 2026
04d57ad
fix(scanner): version the state file; rescan an old state once for sp…
setavenger Oct 1, 2026
e3cd551
Merge branch 'fix/cli-spent-and-labels' (#19, with #17 and #20) into …
setavenger Oct 1, 2026
9740d66
perf(scanner): check the chain with hash lookups instead of re-stream…
setavenger Oct 1, 2026
5492765
fix(tray): hide hidden status blocks (.col display overrode the hidde…
setavenger Oct 1, 2026
52f86d3
Merge branch 'fix/stream-unindexed-height' (#20) into fix/cli-spent-a…
setavenger Oct 1, 2026
abef89a
Merge branch 'fix/cli-spent-and-labels' (#19) into fix/reorg-rollback
setavenger Oct 1, 2026
d989e53
fix(cli): print a failed scan's error with Display, not Debug
setavenger Oct 1, 2026
b7b4f59
Merge branch 'fix/stream-unindexed-height' (#20) into fix/cli-spent-a…
setavenger Oct 1, 2026
824613f
Merge branch 'fix/cli-spent-and-labels' (#19) into fix/reorg-rollback
setavenger Oct 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions blindbit-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bitcoin::secp256k1::{PublicKey, SecretKey};
use blindbit_lib::scanner::{self, ScannerConfig};
use clap::{Parser, Subcommand};
use std::{net::SocketAddr, path::PathBuf, str::FromStr};
use std::{net::SocketAddr, path::PathBuf, process::ExitCode, str::FromStr};

use bitcoin_rev::Network;

Expand Down Expand Up @@ -58,7 +58,20 @@ enum Commands {
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
async fn main() -> ExitCode {
match run().await {
Ok(()) => ExitCode::SUCCESS,
Err(e) => {
// Display, not the Debug form `main` would print for a returned error: a
// stopped scan (`ScanStopped`) says which height it stopped at and where to
// rescan from, and its Debug form is a struct dump.
eprintln!("Error: {e}");
ExitCode::FAILURE
}
}
}

async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let cli = Cli::parse();

match cli.command {
Expand Down
16 changes: 13 additions & 3 deletions blindbit-lib/examples/stream_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let mut stream = client
.stream_block_scan_data_short(request)
.await
.unwrap()
.await?
.into_inner();
while let Some(block_scan_data) = stream.message().await.unwrap() {
// An error status (e.g. NOT_FOUND for a height the oracle has not
// indexed) ends the stream; `?` surfaces it instead of panicking.
while let Some(block_scan_data) = stream.message().await? {
let Some(block_identifier) = block_scan_data.block_identifier.clone() else {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,
"block identifier is missing",
)
.into());
};
// Older oracles answer an unindexed height with an empty block hash
// and no data; that is not an empty block.
if block_identifier.block_hash.len() != 32 {
return Err(format!(
"height {} has no valid block hash; the oracle has probably not indexed it",
block_identifier.block_height
)
.into());
}
println!("height: {}", block_identifier.block_height);
}

Expand Down
Loading
Loading