fix: ensure spend panel steps use latest wallet

The wallet is used in some steps to get fingerprint aliases.

The recovery panel previously handled a wallet update, but this
was omitted when making the recovery panel part of the spend
panel.

This bug already existed for the final step of a regular spend
where the signing information would show old aliases if these
were updated while defining the spend.
This commit is contained in:
Michael Mallan 2025-04-23 13:09:35 +01:00
parent 1213858489
commit 7d2a1d4d31
No known key found for this signature in database
GPG Key ID: 5177CDCEDB0EABEB
2 changed files with 13 additions and 1 deletions

View File

@ -185,8 +185,11 @@ impl State for CreateSpendPanel {
fn reload(
&mut self,
daemon: Arc<dyn Daemon + Sync + Send>,
_wallet: Arc<Wallet>,
wallet: Arc<Wallet>,
) -> Task<Message> {
for step in self.steps.iter_mut() {
step.reload_wallet(wallet.clone());
}
let daemon1 = daemon.clone();
let daemon2 = daemon.clone();
let coin_statuses_1 = if self.draft.is_recovery() {

View File

@ -78,6 +78,7 @@ pub trait Step {
fn apply(&self, _draft: &mut TransactionDraft) {}
fn interrupt(&mut self) {}
fn load(&mut self, _coins: &[Coin], _tip_height: i32, _draft: &TransactionDraft) {}
fn reload_wallet(&mut self, _wallet: Arc<Wallet>) {}
fn subscription(&self) -> Subscription<Message> {
Subscription::none()
}
@ -975,6 +976,10 @@ impl Step for SaveSpend {
));
}
fn reload_wallet(&mut self, wallet: Arc<Wallet>) {
self.wallet = wallet;
}
fn interrupt(&mut self) {
if let Some((psbt_state, _)) = &mut self.spend {
psbt_state.interrupt()
@ -1063,6 +1068,10 @@ impl Step for SelectRecoveryPath {
self.load_from_coins_and_tip_height(coins, tip_height);
}
fn reload_wallet(&mut self, wallet: Arc<Wallet>) {
self.wallet = wallet;
}
fn view<'a>(&'a self, cache: &'a Cache) -> Element<'a, view::Message> {
view::recovery::recovery(
cache,