mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-04 06:13:10 +00:00
feat: remove print spam when running wallet account sync-private
This commit is contained in:
parent
3e303f2c95
commit
80a188e6a3
@ -23,6 +23,7 @@ itertools.workspace = true
|
|||||||
sha2.workspace = true
|
sha2.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
async-stream = "0.3.6"
|
async-stream = "0.3.6"
|
||||||
|
indicatif = { version = "0.18.3", features = ["improved_unicode"] }
|
||||||
|
|
||||||
[dependencies.key_protocol]
|
[dependencies.key_protocol]
|
||||||
path = "../key_protocol"
|
path = "../key_protocol"
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use key_protocol::{
|
|||||||
},
|
},
|
||||||
key_protocol_core::NSSAUserData,
|
key_protocol_core::NSSAUserData,
|
||||||
};
|
};
|
||||||
|
use log::debug;
|
||||||
use nssa::program::Program;
|
use nssa::program::Program;
|
||||||
|
|
||||||
use crate::config::{InitialAccountData, PersistentAccountData, WalletConfig};
|
use crate::config::{InitialAccountData, PersistentAccountData, WalletConfig};
|
||||||
@ -127,7 +128,7 @@ impl WalletChainStore {
|
|||||||
account_id: nssa::AccountId,
|
account_id: nssa::AccountId,
|
||||||
account: nssa_core::account::Account,
|
account: nssa_core::account::Account,
|
||||||
) {
|
) {
|
||||||
println!("inserting at address {account_id}, this account {account:?}");
|
debug!("inserting at address {account_id}, this account {account:?}");
|
||||||
|
|
||||||
let entry = self
|
let entry = self
|
||||||
.user_data
|
.user_data
|
||||||
|
|||||||
@ -306,11 +306,14 @@ impl WalletCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let before_polling = std::time::Instant::now();
|
let before_polling = std::time::Instant::now();
|
||||||
|
let num_of_blocks = block_id - self.last_synced_block;
|
||||||
|
println!("Syncing to block {block_id}. Blocks to sync: {num_of_blocks}");
|
||||||
|
|
||||||
let poller = self.poller.clone();
|
let poller = self.poller.clone();
|
||||||
let mut blocks =
|
let mut blocks =
|
||||||
std::pin::pin!(poller.poll_block_range(self.last_synced_block + 1..=block_id));
|
std::pin::pin!(poller.poll_block_range(self.last_synced_block + 1..=block_id));
|
||||||
|
|
||||||
|
let bar = indicatif::ProgressBar::new(num_of_blocks);
|
||||||
while let Some(block) = blocks.try_next().await? {
|
while let Some(block) = blocks.try_next().await? {
|
||||||
for tx in block.transactions {
|
for tx in block.transactions {
|
||||||
let nssa_tx = NSSATransaction::try_from(&tx)?;
|
let nssa_tx = NSSATransaction::try_from(&tx)?;
|
||||||
@ -319,7 +322,9 @@ impl WalletCore {
|
|||||||
|
|
||||||
self.last_synced_block = block.block_id;
|
self.last_synced_block = block.block_id;
|
||||||
self.store_persistent_data().await?;
|
self.store_persistent_data().await?;
|
||||||
|
bar.inc(1);
|
||||||
}
|
}
|
||||||
|
bar.finish();
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"Synced to block {block_id} in {:?}",
|
"Synced to block {block_id} in {:?}",
|
||||||
@ -379,7 +384,7 @@ impl WalletCore {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
for (affected_account_id, new_acc) in affected_accounts {
|
for (affected_account_id, new_acc) in affected_accounts {
|
||||||
println!(
|
info!(
|
||||||
"Received new account for account_id {affected_account_id:#?} with account object {new_acc:#?}"
|
"Received new account for account_id {affected_account_id:#?} with account object {new_acc:#?}"
|
||||||
);
|
);
|
||||||
self.storage
|
self.storage
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user