Skip to content

Commit

Permalink
example: small fixes, improvements to example-crates
Browse files Browse the repository at this point in the history
  • Loading branch information
ValuedMammal committed Jul 9, 2024
1 parent 0f4ab48 commit 31f8b95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion example-crates/wallet_esplora_async/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn main() -> Result<(), anyhow::Error> {
let mut stdout = std::io::stdout();
move |spk_i, _| {
match once.take() {
Some(_) => print!("\nScanning keychain [{:?}]", kind),
Some(_) => print!("\nScanning keychain [{:?}] {:<3}", kind, spk_i),
None => print!(" {:<3}", spk_i),
};
stdout.flush().expect("must flush");
Expand Down
6 changes: 6 additions & 0 deletions example-crates/wallet_rpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ fn main() -> anyhow::Result<()> {
let connected_to = block_emission.connected_to();
let start_apply_block = Instant::now();
wallet.apply_block_connected_to(&block_emission.block, height, connected_to)?;
if let Some(changeset) = wallet.take_staged() {
db.write(&changeset)?;
}
let elapsed = start_apply_block.elapsed().as_secs_f32();
println!(
"Applied block {} at height {} in {}s",
Expand All @@ -152,6 +155,9 @@ fn main() -> anyhow::Result<()> {
Emission::Mempool(mempool_emission) => {
let start_apply_mempool = Instant::now();
wallet.apply_unconfirmed_txs(mempool_emission.iter().map(|(tx, time)| (tx, *time)));
if let Some(changeset) = wallet.take_staged() {
db.write(&changeset)?;
}
println!(
"Applied unconfirmed transactions in {}s",
start_apply_mempool.elapsed().as_secs_f32()
Expand Down

0 comments on commit 31f8b95

Please sign in to comment.