Merge #1592: [wip] gui: remove default implem of update_wallet_metadata

20bf7f24f005408d671d0bce185cd2c4e9cdaa99 gui: remove default implem of update_wallet_metadata (pythcoiner)

Pull request description:

  this PR remove a duplicate logic introduced in #1576

ACKs for top commit:
  jp1ac4:
    tACK 20bf7f24f0.

Tree-SHA512: fea994fae14b782c23a7281d2893ddf484d5cf45cbba2d9b25c4ff483a24a97e409fcb441297c665f7e650aa9f0f73e8a1f417c8e573e7fda7775f3c7bec2e10
This commit is contained in:
edouardparis 2025-03-20 15:22:50 +01:00
commit a739c977eb
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F

View File

@ -22,7 +22,6 @@ use lianad::{
StartupError,
};
use crate::app::settings::Settings;
use crate::{hw::HardwareWalletConfig, node};
#[derive(Debug)]
@ -369,30 +368,9 @@ pub trait Daemon: Debug {
/// Reimplemented by LianaLite backend
async fn update_wallet_metadata(
&self,
fingerprint_aliases: &HashMap<Fingerprint, String>,
_fingerprint_aliases: &HashMap<Fingerprint, String>,
_hws: &[HardwareWalletConfig],
) -> Result<(), DaemonError> {
if let Some(datadir) = self
.config()
.ok_or(DaemonError::Unexpected("Config missing".into()))?
.data_dir()
{
let network = self.get_info().await?.network;
let mut settings = Settings::from_file(datadir, network)
.map_err(|_| DaemonError::Unexpected("Fail to read Settings from file".into()))?;
let wallet = if settings.wallets.len() == 1 {
settings.wallets.get_mut(0).expect("already checked")
} else {
return Err(DaemonError::Unexpected(
"Settings file contains more than one wallet".into(),
));
};
for fg in wallet.keys_aliases().keys() {
if fingerprint_aliases.contains_key(fg) {
wallet.update_alias(fg, fingerprint_aliases.get(fg).expect("checked"));
}
}
}
Ok(())
}
}