Skip to content
Merged
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Fixed

- **Wallet rename consistency**: renaming a wallet no longer overwrites other
saved wallet details when metadata cannot be read. Overlapping renames and
wallet removals also keep displayed aliases and deleted-wallet metadata
consistent. The rename dialog remains open with the entered name available
for retry when saving fails, and its controls stay disabled while a save is
in progress.

- **Shielded availability notice**: now distinguishes when the connected network
does not support shielded sending from when the current interface mode does
not unlock it.
Expand Down
33 changes: 33 additions & 0 deletions src/backend_task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ pub enum BackendTaskContext {
ScheduledVoteSweep { network: Network },
/// Receive-address derivation for one wallet's deposit flow.
GenerateReceiveAddress { seed_hash: WalletSeedHash },
/// One HD-wallet or imported-key alias update.
WalletRename(WalletTask),
/// A known backend task that needs no finer UI correlation.
Other,
/// An error emitted without an originating backend task.
Expand Down Expand Up @@ -384,6 +386,13 @@ impl BackendTaskContext {
_ => None,
}
}

pub(crate) fn wallet_rename_task(&self) -> Option<&WalletTask> {
match self.operation() {
Self::WalletRename(task) => Some(task),
_ => None,
}
}
}

impl From<&BackendTask> for BackendTaskContext {
Expand Down Expand Up @@ -425,6 +434,10 @@ impl From<&BackendTask> for BackendTaskContext {
seed_hash: *seed_hash,
}
}
BackendTask::WalletTask(
task @ (WalletTask::RenameHdWallet { .. }
| WalletTask::RenameSingleKeyWallet { .. }),
) => Self::WalletRename(task.clone()),
_ => Self::Other,
}
}
Expand Down Expand Up @@ -567,6 +580,20 @@ pub enum BackendTaskSuccessResult {
seed_hash: WalletSeedHash,
address: String,
},
/// An HD wallet's alias was renamed and persisted to the wallet-meta
/// sidecar. Carries the new alias so the screen updates its in-memory label
/// only after the write succeeds.
WalletAliasRenamed {
seed_hash: WalletSeedHash,
alias: String,
},
/// An imported single-key wallet's alias was renamed and persisted to the
/// single-key sidecar. Carries the new alias so the screen updates its
/// in-memory label only after the write succeeds.
SingleKeyAliasRenamed {
address: String,
alias: String,
},
/// The wallet's tracked asset locks, read off the UI thread through the
/// upstream `AssetLockManager`. Carries the `seed_hash` so screens cache
/// and match the result per wallet.
Expand Down Expand Up @@ -1266,6 +1293,12 @@ impl AppContext {
)
.await
}
WalletTask::RenameHdWallet { seed_hash, alias } => {
self.rename_hd_wallet(seed_hash, alias)
}
WalletTask::RenameSingleKeyWallet { address, alias } => {
self.rename_single_key_wallet(address, alias)
}
};

contextualize_wallet_backend_dapi_result(result, backend.as_ref())
Expand Down
17 changes: 17 additions & 0 deletions src/backend_task/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod fund_platform_address_from_asset_lock;
mod fund_platform_address_from_wallet_utxos;
mod generate_platform_receive_address;
mod generate_receive_address;
mod rename_wallet;
mod sign_message_with_identity_key;
mod sign_message_with_key;
mod transfer_platform_credits;
Expand Down Expand Up @@ -258,6 +259,22 @@ pub enum WalletTask {
/// If false, fees are paid from extra wallet balance (recipient receives exact amount).
fee_deduct_from_output: bool,
},
/// Persist a new alias for an HD wallet to the wallet-meta sidecar, off the
/// UI thread. Reads the existing metadata fallibly so a storage/read failure
/// surfaces instead of silently clobbering the other sidecar fields
/// (`is_main` / `core_wallet_name` / xpub / password fields); a genuinely
/// absent row is seeded fresh with the alias and the wallet's xpub. An empty
/// `alias` clears the name.
RenameHdWallet {
seed_hash: WalletSeedHash,
alias: String,
},
/// Persist a new alias for an imported single-key wallet to the single-key
/// sidecar, off the UI thread. An empty `alias` clears the name.
RenameSingleKeyWallet {
address: String,
alias: String,
},
}

#[cfg(test)]
Expand Down
Loading
Loading