mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-20 17:54:41 +00:00
[skip ci] wip
This commit is contained in:
parent
df70bb7a56
commit
a9f7dec112
3 changed files with 22 additions and 26 deletions
|
@ -80,9 +80,16 @@ String getSeedLegacy(String? language) {
|
|||
Map<int, Map<int, Map<int, String>>> addressCache = {};
|
||||
|
||||
String getAddress({int accountIndex = 0, int addressIndex = 0}) {
|
||||
|
||||
|
||||
int count = 0;
|
||||
|
||||
while (monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex) - 1 < addressIndex) {
|
||||
printV("adding subaddress");
|
||||
monero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex);
|
||||
if (count > 50) {
|
||||
throw Exception("Failed to add subaddress");
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
addressCache[wptr!.address] ??= {};
|
||||
|
|
|
@ -162,8 +162,8 @@ abstract class MoneroWalletBase
|
|||
bool isMainThread = Isolate.current.debugName == "main";
|
||||
printV("isMainThread: $isMainThread");
|
||||
|
||||
// _autoSaveTimer =
|
||||
// Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
|
||||
_autoSaveTimer =
|
||||
Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
|
||||
|
||||
// update transaction details after restore
|
||||
walletAddresses.subaddressList.update(accountIndex: walletAddresses.account?.id ?? 0);
|
||||
|
@ -203,34 +203,21 @@ abstract class MoneroWalletBase
|
|||
|
||||
@override
|
||||
Future<void> startSync({bool isBackgroundSync = false}) async {
|
||||
// if (isBackgroundSync) {
|
||||
// try {
|
||||
// syncStatus = AttemptingSyncStatus();
|
||||
// monero_wallet.startBackgroundSync();
|
||||
// isBackgroundSyncing = true;
|
||||
// _setListeners();
|
||||
// _listener?.start();
|
||||
// return;
|
||||
// } catch (e) {
|
||||
// isBackgroundSyncing = false;
|
||||
// syncStatus = FailedSyncStatus();
|
||||
// printV(e);
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
|
||||
try {
|
||||
syncStatus = AttemptingSyncStatus();
|
||||
// monero_wallet.startRefresh();
|
||||
monero_wallet.setupBackgroundSync(
|
||||
backgroundSyncType: 2,
|
||||
walletPassword: password,
|
||||
backgroundCachePassword: "testing-cache-password",
|
||||
);
|
||||
monero_wallet.startBackgroundSync();
|
||||
if (isBackgroundSync) {
|
||||
monero_wallet.setupBackgroundSync(
|
||||
backgroundSyncType: 2,
|
||||
walletPassword: password,
|
||||
backgroundCachePassword: "testing-cache-password",
|
||||
);
|
||||
monero_wallet.startBackgroundSync();
|
||||
isBackgroundSyncing = true;
|
||||
} else {
|
||||
monero_wallet.stopBackgroundSync(password);
|
||||
isBackgroundSyncing = false;
|
||||
}
|
||||
monero_wallet.startRefresh();
|
||||
_setListeners();
|
||||
_listener?.start();
|
||||
} catch (e) {
|
||||
|
|
|
@ -146,11 +146,13 @@ Future<void> onStart(ServiceInstance service) async {
|
|||
for (int i = 0; i < syncingWallets.length; i++) {
|
||||
final wallet = syncingWallets[i];
|
||||
await wallet.stopSync(isBackgroundSync: true);
|
||||
await wallet.close();
|
||||
}
|
||||
// stop all standby wallets (just in case):
|
||||
for (int i = 0; i < standbyWallets.length; i++) {
|
||||
final wallet = standbyWallets[i];
|
||||
await wallet.stopSync(isBackgroundSync: true);
|
||||
await wallet.close();
|
||||
}
|
||||
} catch (e) {
|
||||
printV("error stopping sync: $e");
|
||||
|
|
Loading…
Reference in a new issue