Cyjan zec mutex 2 (#3569)

* fix: mutex on zec

* refactor: simplify orchard migratable balance checks and update related methods
This commit is contained in:
cyan
2026-08-27 10:58:22 +08:00
committed by GitHub
parent 06e75551a7
commit 3ba43ede62
4 changed files with 19 additions and 47 deletions
@@ -96,7 +96,6 @@ abstract class DashboardViewModelBase with Store {
isShowFirstYatIntroduction = false,
isShowSecondYatIntroduction = false,
isShowThirdYatIntroduction = false,
isMigratingToIronwood = false,
filterItems = [],
exchangeFilterItems = [],
subname = '',
@@ -251,8 +250,6 @@ abstract class DashboardViewModelBase with Store {
reaction((_) => tradesStore.trades, (_) => tradeMonitor.monitorActiveTrades(wallet.id));
addZcashMigrationReaction();
tradeMonitor.monitorActiveTrades(wallet.id);
}
@@ -377,21 +374,9 @@ abstract class DashboardViewModelBase with Store {
);
}
@observable
ReactionDisposer? zcashMigrationReactionDisposer;
@action
void addZcashMigrationReaction() {
zcashMigrationReactionDisposer?.reaction.dispose();
zcashMigrationReactionDisposer = null;
if (wallet.type == WalletType.zcash) {
zcashMigrationReactionDisposer = reaction((_) => wallet.balance.values.first, (_) async {
isMigratingToIronwood =
wallet.type == WalletType.zcash && await zcash!.hasOrchardMigratableBalance(wallet);
});
}
}
@computed
bool get isMigratingToIronwood =>
wallet.type == WalletType.zcash && (zcash?.hasOrchardMigratableBalance(wallet) ?? false);
@computed
bool get isSyncHeavy {
@@ -1289,8 +1274,6 @@ abstract class DashboardViewModelBase with Store {
name = wallet.name;
loadFilterItems();
addZcashMigrationReaction();
if (wallet.type == WalletType.monero) {
subname = monero!.getCurrentAccount(wallet).label;
@@ -1572,9 +1555,6 @@ abstract class DashboardViewModelBase with Store {
}
}
@observable
bool isMigratingToIronwood;
String getTransactionType(TransactionInfo tx) {
if (wallet.type == WalletType.bitcoin) {
if (tx.isReplaced == true) return ' (replaced)';
+1 -1
View File
@@ -223,7 +223,7 @@ class CWZcash extends Zcash {
}
@override
Future<bool> hasOrchardMigratableBalance(WalletBase wallet) {
bool hasOrchardMigratableBalance(WalletBase wallet) {
return (wallet as ZcashWallet).hasOrchardMigratableBalance();
}
}