Skip to content

Commit 31f8b95

Browse files
committed
example: small fixes, improvements to example-crates
1 parent 0f4ab48 commit 31f8b95

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

example-crates/wallet_esplora_async/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async fn main() -> Result<(), anyhow::Error> {
4444
let mut stdout = std::io::stdout();
4545
move |spk_i, _| {
4646
match once.take() {
47-
Some(_) => print!("\nScanning keychain [{:?}]", kind),
47+
Some(_) => print!("\nScanning keychain [{:?}] {:<3}", kind, spk_i),
4848
None => print!(" {:<3}", spk_i),
4949
};
5050
stdout.flush().expect("must flush");

example-crates/wallet_rpc/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ fn main() -> anyhow::Result<()> {
143143
let connected_to = block_emission.connected_to();
144144
let start_apply_block = Instant::now();
145145
wallet.apply_block_connected_to(&block_emission.block, height, connected_to)?;
146+
if let Some(changeset) = wallet.take_staged() {
147+
db.write(&changeset)?;
148+
}
146149
let elapsed = start_apply_block.elapsed().as_secs_f32();
147150
println!(
148151
"Applied block {} at height {} in {}s",
@@ -152,6 +155,9 @@ fn main() -> anyhow::Result<()> {
152155
Emission::Mempool(mempool_emission) => {
153156
let start_apply_mempool = Instant::now();
154157
wallet.apply_unconfirmed_txs(mempool_emission.iter().map(|(tx, time)| (tx, *time)));
158+
if let Some(changeset) = wallet.take_staged() {
159+
db.write(&changeset)?;
160+
}
155161
println!(
156162
"Applied unconfirmed transactions in {}s",
157163
start_apply_mempool.elapsed().as_secs_f32()

0 commit comments

Comments
 (0)