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

Fix update of rescan state upon completion #1530

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion liana-gui/src/app/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{
pub enum Message {
Tick,
UpdateCache(Result<Cache, Error>),
UpdatePanelCache(/* is current panel */ bool, Result<Cache, Error>),
UpdatePanelCache(/* is current panel */ bool),
View(view::Message),
LoadDaemonConfig(Box<DaemonConfig>),
DaemonConfigLoaded(Result<(), Error>),
Expand Down
7 changes: 5 additions & 2 deletions liana-gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,17 @@ impl App {
let current = &self.panels.current;
let daemon = self.daemon.clone();
// These are the panels to update with the cache.
let mut panels = [(&mut self.panels.home, Menu::Home)];
let mut panels = [
(&mut self.panels.home as &mut dyn State, Menu::Home),
(&mut self.panels.settings as &mut dyn State, Menu::Settings),
];
let commands: Vec<_> = panels
.iter_mut()
.map(|(panel, menu)| {
panel.update(
daemon.clone(),
&cache,
Message::UpdatePanelCache(current == menu, Ok(cache.clone())),
Message::UpdatePanelCache(current == menu),
)
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion liana-gui/src/app/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl State for Home {
}
}
},
Message::UpdatePanelCache(is_current, Ok(cache)) => {
Message::UpdatePanelCache(is_current) => {
let wallet_was_syncing = !self.sync_status.is_synced();
self.sync_status = sync_status(
daemon.backend(),
Expand Down
3 changes: 3 additions & 0 deletions liana-gui/src/app/state/settings/bitcoind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ impl State for BitcoindSettingsState {
self.rescan_settings.past_possible_height = true;
self.rescan_settings.processing = false;
}
Message::UpdatePanelCache(_) => {
self.rescan_settings.processing = cache.rescan_progress.is_some_and(|p| p < 1.0);
}
Message::View(view::Message::Settings(view::SettingsMessage::BitcoindSettings(
msg,
))) => {
Expand Down
Loading