Skip to content

Commit

Permalink
gui: stop auto load of address when opening receive panel
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Jan 2, 2025
1 parent 83581e1 commit 1b3c408
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions liana-gui/src/app/state/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,12 @@ impl State for ReceivePanel {

fn reload(
&mut self,
daemon: Arc<dyn Daemon + Sync + Send>,
_daemon: Arc<dyn Daemon + Sync + Send>,
wallet: Arc<Wallet>,
) -> Command<Message> {
self.wallet = wallet;
self.addresses = Addresses::default();
let daemon = daemon.clone();
Command::perform(
async move {
daemon
.get_new_address()
.await
.map(|res| (res.address, res.derivation_index))
.map_err(|e| e.into())
},
Message::ReceiveAddress,
)
Command::none()
}
}

Expand Down Expand Up @@ -338,7 +328,7 @@ async fn verify_address(
mod tests {
use super::*;
use crate::{
app::cache::Cache,
app::{cache::Cache, view::Message as viewMessage, Message},
daemon::{
client::{Lianad, Request},
model::*,
Expand Down Expand Up @@ -369,7 +359,11 @@ mod tests {
let sandbox: Sandbox<ReceivePanel> =
Sandbox::new(ReceivePanel::new(PathBuf::new(), wallet.clone()));
let client = Arc::new(Lianad::new(daemon.run()));
let sandbox = sandbox.load(client, &Cache::default(), wallet).await;
let cache = Cache::default();
let sandbox = sandbox.load(client.clone(), &cache, wallet).await;
let sandbox = sandbox
.update(client, &cache, Message::View(viewMessage::Next))
.await;

let panel = sandbox.state();
assert_eq!(panel.addresses.list, vec![addr]);
Expand Down

0 comments on commit 1b3c408

Please sign in to comment.