Skip to content

Commit

Permalink
wip - event renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Sep 8, 2023
1 parent ede9a67 commit e50fdca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ impl KaspaCli {
Events::WalletClose => {
this.term().refresh_prompt();
},
Events::DAAScoreChange { daa_score } => {
Events::DAAScoreChange { current_daa_score } => {
if this.is_mutted() && this.flags.get(Track::Daa) {
tprintln!(this, "{NOTIFY} DAA: {daa_score}");
tprintln!(this, "{NOTIFY} DAA: {current_daa_score}");
}
},
Events::Reorg {
Expand Down
2 changes: 1 addition & 1 deletion wallet/core/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub enum Events {
/// for an unknown reason. (general error trap)
UtxoProcError { message: String },
/// DAA score change
DAAScoreChange { daa_score: u64 },
DAAScoreChange { current_daa_score: u64 },
/// New incoming pending UTXO/transaction
Pending {
record: TransactionRecord,
Expand Down
2 changes: 1 addition & 1 deletion wallet/core/src/runtime/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Wallet {
/// For end-user wallets only - activates all accounts in the wallet
/// storage.
pub async fn activate_all_stored_accounts(self: &Arc<Wallet>) -> Result<Vec<Arc<dyn Account>>> {
Ok(self.accounts(None).await?.try_collect::<Vec<_>>().await?)
self.accounts(None).await?.try_collect::<Vec<_>>().await
}

/// Select an account as 'active'. Supply `None` to remove active selection.
Expand Down
14 changes: 7 additions & 7 deletions wallet/core/src/utxo/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,20 @@ impl UtxoProcessor {
Ok(())
}

pub async fn handle_daa_score_change(&self, daa_score: u64) -> Result<()> {
self.inner.current_daa_score.store(daa_score, Ordering::SeqCst);
self.notify(Events::DAAScoreChange { daa_score }).await?;
self.handle_pending(daa_score).await?;
self.handle_recoverable(daa_score).await?;
pub async fn handle_daa_score_change(&self, current_daa_score: u64) -> Result<()> {
self.inner.current_daa_score.store(current_daa_score, Ordering::SeqCst);
self.notify(Events::DAAScoreChange { current_daa_score }).await?;
self.handle_pending(current_daa_score).await?;
self.handle_recoverable(current_daa_score).await?;
Ok(())
}

pub async fn handle_pending(&self, daa_score: u64) -> Result<()> {
pub async fn handle_pending(&self, current_daa_score: u64) -> Result<()> {
let mature_entries = {
let mut mature_entries = vec![];
let pending_entries = &self.inner.pending;
pending_entries.retain(|_, pending| {
if pending.is_mature(daa_score) {
if pending.is_mature(current_daa_score) {
mature_entries.push(pending.clone());
false
} else {
Expand Down

0 comments on commit e50fdca

Please sign in to comment.