mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 20:09:24 +00:00
Minor cleanup
This commit is contained in:
parent
752b6bbebf
commit
86a3b6d65d
2 changed files with 24 additions and 28 deletions
|
@ -582,6 +582,8 @@ abstract class ElectrumWalletBase extends WalletBase<
|
|||
Future<void> connectToNode({required Node node}) async {
|
||||
this.node = node;
|
||||
|
||||
// if (syncStatus is ConnectingSyncStatus || syn) return;
|
||||
|
||||
try {
|
||||
syncStatus = ConnectingSyncStatus();
|
||||
|
||||
|
@ -2090,7 +2092,7 @@ abstract class ElectrumWalletBase extends WalletBase<
|
|||
});
|
||||
}
|
||||
|
||||
final balances = await Future.wait(balanceFutures);
|
||||
final balances = await Future.wait(balanceFutures); // ToDo: add onError ignore failed balances
|
||||
|
||||
for (var i = 0; i < balances.length; i++) {
|
||||
final addressRecord = addresses[i];
|
||||
|
@ -2229,13 +2231,14 @@ abstract class ElectrumWalletBase extends WalletBase<
|
|||
if (syncStatus is NotConnectedSyncStatus ||
|
||||
syncStatus is LostConnectionSyncStatus ||
|
||||
syncStatus is ConnectingSyncStatus) {
|
||||
syncStatus = AttemptingSyncStatus();
|
||||
startSync();
|
||||
syncStatus = ConnectedSyncStatus();
|
||||
}
|
||||
|
||||
break;
|
||||
case ConnectionStatus.disconnected:
|
||||
if (syncStatus is! NotConnectedSyncStatus) {
|
||||
if (syncStatus is! NotConnectedSyncStatus &&
|
||||
syncStatus is! ConnectingSyncStatus &&
|
||||
syncStatus is! SyncronizingSyncStatus) {
|
||||
syncStatus = NotConnectedSyncStatus();
|
||||
}
|
||||
break;
|
||||
|
@ -2292,10 +2295,8 @@ abstract class ElectrumWalletBase extends WalletBase<
|
|||
void _updateInputsAndOutputs(ElectrumTransactionInfo tx, ElectrumTransactionBundle bundle) {
|
||||
tx.inputAddresses = tx.inputAddresses?.where((address) => address.isNotEmpty).toList();
|
||||
|
||||
if (tx.inputAddresses == null ||
|
||||
tx.inputAddresses!.isEmpty ||
|
||||
tx.outputAddresses == null ||
|
||||
tx.outputAddresses!.isEmpty) {
|
||||
if (tx.inputAddresses?.isNotEmpty != true ||
|
||||
tx.outputAddresses?.isNotEmpty != true) {
|
||||
List<String> inputAddresses = [];
|
||||
List<String> outputAddresses = [];
|
||||
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
abstract class SyncStatus {
|
||||
const SyncStatus();
|
||||
double progress();
|
||||
}
|
||||
|
||||
class StartingScanSyncStatus extends SyncStatus {
|
||||
StartingScanSyncStatus(this.beginHeight);
|
||||
|
||||
final int beginHeight;
|
||||
@override
|
||||
double progress() => 0.0;
|
||||
}
|
||||
|
||||
|
@ -39,16 +31,25 @@ class SyncedSyncStatus extends SyncStatus {
|
|||
double progress() => 1.0;
|
||||
}
|
||||
|
||||
/// ===========================================================================
|
||||
|
||||
abstract class ScanSyncStatus extends SyncStatus {}
|
||||
|
||||
class StartingScanSyncStatus extends SyncStatus {
|
||||
StartingScanSyncStatus(this.beginHeight);
|
||||
|
||||
final int beginHeight;
|
||||
}
|
||||
|
||||
class SyncedTipSyncStatus extends SyncedSyncStatus {
|
||||
SyncedTipSyncStatus(this.tip);
|
||||
|
||||
final int tip;
|
||||
}
|
||||
|
||||
class SyncronizingSyncStatus extends SyncStatus {
|
||||
@override
|
||||
double progress() => 0.0;
|
||||
}
|
||||
/// ===========================================================================
|
||||
|
||||
class SyncronizingSyncStatus extends SyncStatus {}
|
||||
|
||||
class NotConnectedSyncStatus extends SyncStatus {
|
||||
const NotConnectedSyncStatus();
|
||||
|
@ -75,15 +76,9 @@ class FailedSyncStatus extends NotConnectedSyncStatus {
|
|||
String toString() => error ?? super.toString();
|
||||
}
|
||||
|
||||
class ConnectingSyncStatus extends SyncStatus {
|
||||
@override
|
||||
double progress() => 0.0;
|
||||
}
|
||||
class ConnectingSyncStatus extends SyncStatus {}
|
||||
|
||||
class ConnectedSyncStatus extends SyncStatus {
|
||||
@override
|
||||
double progress() => 0.0;
|
||||
}
|
||||
class ConnectedSyncStatus extends SyncStatus {}
|
||||
|
||||
class UnsupportedSyncStatus extends NotConnectedSyncStatus {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue