Merge #1512: gui: stop auto load of address when opening receive panel

1b3c4080c7a2a5894f019dccdbc140d33e8bfb77 gui: stop auto load of address when opening receive panel (edouardparis)

Pull request description:

  close https://github.com/wizardsardine/liana/issues/1461
  Stop generating addresses without user explicitly asking so.
  Otherwise, the gap will be too big and some rescan with default gap limit on other wallets will not detect funds.

ACKs for top commit:
  pythcoiner:
    tACK 1b3c4080
  jp1ac4:
    tACK 1b3c4080c7.

Tree-SHA512: 97679dd0cceb9038342bc2bf5a91dd4f93134e5d13877e4aa4a327eedaa620230d166baf46beb870f2cf71d39bfeffd88f9926f4bd1816b5af006761f88b1b0f
This commit is contained in:
edouardparis 2025-01-02 17:23:01 +01:00
commit 4d22a6f4f7
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F

View File

@ -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()
}
}
@ -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::*,
@ -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]);