Skip to content

Commit

Permalink
backport 1530: Fix update of rescan state upon completion
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Jan 13, 2025
1 parent e72dd8b commit cfb585e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
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

0 comments on commit cfb585e

Please sign in to comment.