Skip to content

Commit 84bb8af

Browse files
fixup/justfile: release mode
1 parent 8315601 commit 84bb8af

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@ run-example-regtest:
119119
# Generate initial blocks
120120
just generate-blocks
121121
# Run the regtest example
122-
cargo run --example regtest_bdk_sqlx_postgres
122+
cargo run -r --example regtest_bdk_sqlx_postgres

examples/regtest_bdk_sqlx_postgres.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn main() -> anyhow::Result<()> {
4747
.with(EnvFilter::new(std::env::var("RUST_LOG").unwrap_or_else(
4848
|_| {
4949
"sqlx=warn,\
50-
bdk_sqlx=debug"
50+
bdk_sqlx=debug,trace"
5151
.into()
5252
},
5353
)))

src/postgres.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,11 @@ async fn load_keychain_spks(
622622
descriptor_id: DescriptorId,
623623
changeset: &mut ChangeSet,
624624
) -> Result<()> {
625-
trace!("load keychain spks");
625+
let start_time = std::time::Instant::now();
626+
trace!("load keychain spks - starting");
627+
println!("load_keychain_spks: Starting for wallet '{}', descriptor_id: {:?}", wallet_name, descriptor_id);
626628

629+
let query_start = std::time::Instant::now();
627630
let rows = sqlx::query(
628631
r#"SELECT idx, script FROM "bdk_wallet"."keychain_spk"
629632
WHERE wallet_name = $1 AND descriptor_id = $2
@@ -637,17 +640,26 @@ async fn load_keychain_spks(
637640
table: "select keychain_spk".to_string(),
638641
source: e,
639642
})?;
643+
let query_duration = query_start.elapsed();
644+
println!("load_keychain_spks: Query completed in {:?}, fetched {} rows", query_duration, rows.len());
640645

641646
if !rows.is_empty() {
647+
let processing_start = std::time::Instant::now();
642648
let mut spks = BTreeMap::new();
643649
for row in rows {
644650
let idx: i32 = row.get("idx");
645651
let script: Vec<u8> = row.get("script");
646652
spks.insert(idx as u32, ScriptBuf::from_bytes(script));
647653
}
648654
changeset.indexer.spk_cache.insert(descriptor_id, spks);
655+
let processing_duration = processing_start.elapsed();
656+
println!("load_keychain_spks: Processing rows completed in {:?}", processing_duration);
649657
}
650658

659+
let total_duration = start_time.elapsed();
660+
println!("load_keychain_spks: Total function execution time: {:?}", total_duration);
661+
trace!("load keychain spks - completed in {:?}", total_duration);
662+
651663
Ok(())
652664
}
653665

0 commit comments

Comments
 (0)