! handle the clean transactions correctly before fully synced

! sync all wallets correctly
This commit is contained in:
Taegus
2018-12-28 15:25:39 +01:00
parent 1c629801c4
commit 19a7052398
5 changed files with 61 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "Ether1Wallet",
"version": "0.1.3",
"version": "0.2.1",
"description": "Desktop wallet for Ether1 currency",
"main": "main.js",
"scripts": {

View File

@@ -230,6 +230,7 @@ class Blockchain {
}
unsubsribePendingTransactions(clbError, clbSuccess) {
if (this.txSubscribe) {
this.txSubscribe.unsubscribe(function(error, success){
if(error) {
clbError(error);
@@ -238,6 +239,7 @@ class Blockchain {
}
});
}
}
subsribeNewBlockHeaders(clbError, clbSuccess, clbData) {
this.bhSubscribe = web3Local.eth.subscribe('newBlockHeaders', function(error, result){
@@ -254,6 +256,7 @@ class Blockchain {
}
unsubsribeNewBlockHeaders(clbError, clbSuccess) {
if (this.bhSubscribe) {
this.bhSubscribe.unsubscribe(function(error, success){
if(error) {
clbError(error);
@@ -262,6 +265,7 @@ class Blockchain {
}
});
}
}
closeConnection() {
web3Local.currentProvider.connection.close();

View File

@@ -12,6 +12,7 @@ class Settings {
$(document).on("render_settings", function() {
$("#btnSettingsCleanTransactions").off('click').on('click', function() {
if (isFullySynced) {
EthoMainGUI.showGeneralConfirmation("Do you really want to resync transactions?", function(result) {
if (result) {
if (EthoTransactions.getIsSyncing()) {
@@ -43,6 +44,14 @@ $(document).on("render_settings", function() {
}
}
});
} else {
iziToast.info({
title: 'Wait...',
message: 'You need to be fully sync before cleaning transactions',
position: 'topRight',
timeout: 5000
});
}
});
$("#btnSettingsCleanWallets").off('click').on('click', function() {

View File

@@ -29,6 +29,7 @@ SyncProgress = new ProgressBar.Line('#syncProgress',
// set initial value for the progress text
SyncProgress.setText("Waiting for blockchain, please wait...");
isFullySynced = false;
var peerCountInterval = setInterval(function()
{
@@ -62,6 +63,7 @@ function StartSyncProcess() {
// clear the repeat interval and render wallets
$(document).trigger("onNewAccountTransaction");
alreadyCatchedUp = true;
isFullySynced = true;
// enable the keep in sync feature
EthoTransactions.enableKeepInSync();

View File

@@ -27,7 +27,7 @@ class Transactions {
}
syncTransactionsForSingleAddress(addressList, counters, lastBlock, counter) {
if (counter < addressList.length - 1) {
if (counter < addressList.length) {
SyncProgress.setText(vsprintf("Syncing address transactions %d/%d, please wait...", [counter, addressList.length]));
var startBlock = parseInt(counters.transactions) || 0;