refactor maxConsecutiveFusionRoundsFailed->failed

This commit is contained in:
sneurlax 2023-10-19 12:52:21 -05:00
parent 4a619d68ad
commit d5c4923031
2 changed files with 10 additions and 7 deletions

View file

@ -109,7 +109,7 @@ class FusionProgressUIState extends ChangeNotifier {
void incrementFusionRoundsCompleted() { void incrementFusionRoundsCompleted() {
_fusionRoundsCompleted++; _fusionRoundsCompleted++;
_fusionRoundsFailed = 0; // Reset failed round count on success. _fusionRoundsFailed = 0; // Reset failed round count on success.
_maxConsecutiveFusionRoundsFailed = false; // Reset failed flag on success. _failed = false; // Reset failed flag on success.
notifyListeners(); notifyListeners();
} }
@ -129,11 +129,14 @@ class FusionProgressUIState extends ChangeNotifier {
/// A flag indicating that fusion has stopped because the maximum number of /// A flag indicating that fusion has stopped because the maximum number of
/// consecutive failed fusion rounds has been reached. /// consecutive failed fusion rounds has been reached.
bool _maxConsecutiveFusionRoundsFailed = false; ///
bool get maxConsecutiveFusionRoundsFailed => /// Set from the interface. I didn't want to have to configure
_maxConsecutiveFusionRoundsFailed; ///
set maxConsecutiveFusionRoundsFailed(bool maxConsecutiveFusionRoundsFailed) { /// Used to be named maxConsecutiveFusionRoundsFailed.
_maxConsecutiveFusionRoundsFailed = maxConsecutiveFusionRoundsFailed; bool _failed = true;
bool get failed => _failed;
set failed(bool failed) {
_failed = failed;
notifyListeners(); notifyListeners();
} }
} }

View file

@ -572,7 +572,7 @@ mixin FusionWalletInterface {
// If we fail too many times in a row, stop trying. // If we fail too many times in a row, stop trying.
if (_failedFuseCount >= maxFailedFuseCount) { if (_failedFuseCount >= maxFailedFuseCount) {
_stopRequested = true; _stopRequested = true;
_uiState?.maxConsecutiveFusionRoundsFailed = true; _uiState?.failed = true;
} }
} finally { } finally {
// Increment the number of successfully completed fusion rounds. // Increment the number of successfully completed fusion rounds.