mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-24 11:36:21 +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 {
|
Future<void> connectToNode({required Node node}) async {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
|
||||||
|
// if (syncStatus is ConnectingSyncStatus || syn) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
syncStatus = ConnectingSyncStatus();
|
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++) {
|
for (var i = 0; i < balances.length; i++) {
|
||||||
final addressRecord = addresses[i];
|
final addressRecord = addresses[i];
|
||||||
|
@ -2229,13 +2231,14 @@ abstract class ElectrumWalletBase extends WalletBase<
|
||||||
if (syncStatus is NotConnectedSyncStatus ||
|
if (syncStatus is NotConnectedSyncStatus ||
|
||||||
syncStatus is LostConnectionSyncStatus ||
|
syncStatus is LostConnectionSyncStatus ||
|
||||||
syncStatus is ConnectingSyncStatus) {
|
syncStatus is ConnectingSyncStatus) {
|
||||||
syncStatus = AttemptingSyncStatus();
|
syncStatus = ConnectedSyncStatus();
|
||||||
startSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ConnectionStatus.disconnected:
|
case ConnectionStatus.disconnected:
|
||||||
if (syncStatus is! NotConnectedSyncStatus) {
|
if (syncStatus is! NotConnectedSyncStatus &&
|
||||||
|
syncStatus is! ConnectingSyncStatus &&
|
||||||
|
syncStatus is! SyncronizingSyncStatus) {
|
||||||
syncStatus = NotConnectedSyncStatus();
|
syncStatus = NotConnectedSyncStatus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2292,10 +2295,8 @@ abstract class ElectrumWalletBase extends WalletBase<
|
||||||
void _updateInputsAndOutputs(ElectrumTransactionInfo tx, ElectrumTransactionBundle bundle) {
|
void _updateInputsAndOutputs(ElectrumTransactionInfo tx, ElectrumTransactionBundle bundle) {
|
||||||
tx.inputAddresses = tx.inputAddresses?.where((address) => address.isNotEmpty).toList();
|
tx.inputAddresses = tx.inputAddresses?.where((address) => address.isNotEmpty).toList();
|
||||||
|
|
||||||
if (tx.inputAddresses == null ||
|
if (tx.inputAddresses?.isNotEmpty != true ||
|
||||||
tx.inputAddresses!.isEmpty ||
|
tx.outputAddresses?.isNotEmpty != true) {
|
||||||
tx.outputAddresses == null ||
|
|
||||||
tx.outputAddresses!.isEmpty) {
|
|
||||||
List<String> inputAddresses = [];
|
List<String> inputAddresses = [];
|
||||||
List<String> outputAddresses = [];
|
List<String> outputAddresses = [];
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
abstract class SyncStatus {
|
abstract class SyncStatus {
|
||||||
const SyncStatus();
|
const SyncStatus();
|
||||||
double progress();
|
|
||||||
}
|
|
||||||
|
|
||||||
class StartingScanSyncStatus extends SyncStatus {
|
|
||||||
StartingScanSyncStatus(this.beginHeight);
|
|
||||||
|
|
||||||
final int beginHeight;
|
|
||||||
@override
|
|
||||||
double progress() => 0.0;
|
double progress() => 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,16 +31,25 @@ class SyncedSyncStatus extends SyncStatus {
|
||||||
double progress() => 1.0;
|
double progress() => 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ===========================================================================
|
||||||
|
|
||||||
|
abstract class ScanSyncStatus extends SyncStatus {}
|
||||||
|
|
||||||
|
class StartingScanSyncStatus extends SyncStatus {
|
||||||
|
StartingScanSyncStatus(this.beginHeight);
|
||||||
|
|
||||||
|
final int beginHeight;
|
||||||
|
}
|
||||||
|
|
||||||
class SyncedTipSyncStatus extends SyncedSyncStatus {
|
class SyncedTipSyncStatus extends SyncedSyncStatus {
|
||||||
SyncedTipSyncStatus(this.tip);
|
SyncedTipSyncStatus(this.tip);
|
||||||
|
|
||||||
final int tip;
|
final int tip;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SyncronizingSyncStatus extends SyncStatus {
|
/// ===========================================================================
|
||||||
@override
|
|
||||||
double progress() => 0.0;
|
class SyncronizingSyncStatus extends SyncStatus {}
|
||||||
}
|
|
||||||
|
|
||||||
class NotConnectedSyncStatus extends SyncStatus {
|
class NotConnectedSyncStatus extends SyncStatus {
|
||||||
const NotConnectedSyncStatus();
|
const NotConnectedSyncStatus();
|
||||||
|
@ -75,15 +76,9 @@ class FailedSyncStatus extends NotConnectedSyncStatus {
|
||||||
String toString() => error ?? super.toString();
|
String toString() => error ?? super.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConnectingSyncStatus extends SyncStatus {
|
class ConnectingSyncStatus extends SyncStatus {}
|
||||||
@override
|
|
||||||
double progress() => 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ConnectedSyncStatus extends SyncStatus {
|
class ConnectedSyncStatus extends SyncStatus {}
|
||||||
@override
|
|
||||||
double progress() => 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class UnsupportedSyncStatus extends NotConnectedSyncStatus {}
|
class UnsupportedSyncStatus extends NotConnectedSyncStatus {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue