Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: trigger time lock balance update when block received #3567

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions applications/tari_console_wallet/src/ui/state/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,15 @@ impl AppStateInner {
Ok(())
}

pub fn has_time_locked_balance(&self) -> bool {
if let Some(time_locked_balance) = self.data.balance.time_locked_balance {
if time_locked_balance > MicroTari::from(0) {
return true;
}
}
false
}

pub async fn refresh_balance(&mut self, balance: Balance) -> Result<(), UiError> {
self.data.balance = balance;
self.updated = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ impl WalletEventMonitor {
if let Err(e) = inner.refresh_base_node_state(state).await {
warn!(target: LOG_TARGET, "Error refresh app_state: {}", e);
}

if inner.has_time_locked_balance() {
if let Err(e) = self.balance_enquiry_debounce_tx.send(()) {
warn!(target: LOG_TARGET, "Error refresh app_state: {}", e);
}
}
}

async fn trigger_base_node_peer_refresh(&mut self, peer: Peer) {
Expand Down