manual cherry picking part 2

This commit is contained in:
julian 2023-11-14 16:35:24 -06:00
parent be66c71154
commit d29e4e97e2

View file

@ -696,6 +696,10 @@ mixin CashFusion on CoinControl, ElectrumX {
// Fuse UTXOs.
try {
if (coinList.isEmpty) {
throw Exception("Started with no coins");
}
await _mainFusionObject!.fuse(
inputsFromWallet: coinList,
network: cryptoCurrency.networkParams,
@ -723,6 +727,16 @@ mixin CashFusion on CoinControl, ElectrumX {
// Do the same for the UI state.
_uiState?.incrementFusionRoundsFailed();
// If we have no coins, stop trying.
if (coinList.isEmpty ||
e.toString().contains("Started with no coins")) {
_updateStatus(
status: fusion.FusionStatus.failed,
info: "Started with no coins, stopping.");
_stopRequested = true;
_uiState?.setFailed(true, shouldNotify: true);
}
// If we fail too many times in a row, stop trying.
if (_failedFuseCount >= maxFailedFuseCount) {
_updateStatus(