! handle the clean transactions correctly before fully synced
! sync all wallets correctly
This commit is contained in:
@@ -230,13 +230,15 @@ class Blockchain {
|
||||
}
|
||||
|
||||
unsubsribePendingTransactions(clbError, clbSuccess) {
|
||||
this.txSubscribe.unsubscribe(function(error, success){
|
||||
if(error) {
|
||||
clbError(error);
|
||||
} else {
|
||||
clbSuccess(success) ;
|
||||
}
|
||||
});
|
||||
if (this.txSubscribe) {
|
||||
this.txSubscribe.unsubscribe(function(error, success){
|
||||
if(error) {
|
||||
clbError(error);
|
||||
} else {
|
||||
clbSuccess(success) ;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
subsribeNewBlockHeaders(clbError, clbSuccess, clbData) {
|
||||
@@ -254,13 +256,15 @@ class Blockchain {
|
||||
}
|
||||
|
||||
unsubsribeNewBlockHeaders(clbError, clbSuccess) {
|
||||
this.bhSubscribe.unsubscribe(function(error, success){
|
||||
if(error) {
|
||||
clbError(error);
|
||||
} else {
|
||||
clbSuccess(success) ;
|
||||
}
|
||||
});
|
||||
if (this.bhSubscribe) {
|
||||
this.bhSubscribe.unsubscribe(function(error, success){
|
||||
if(error) {
|
||||
clbError(error);
|
||||
} else {
|
||||
clbSuccess(success) ;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
closeConnection() {
|
||||
|
||||
@@ -12,37 +12,46 @@ class Settings {
|
||||
|
||||
$(document).on("render_settings", function() {
|
||||
$("#btnSettingsCleanTransactions").off('click').on('click', function() {
|
||||
EthoMainGUI.showGeneralConfirmation("Do you really want to resync transactions?", function(result) {
|
||||
if (result) {
|
||||
if (EthoTransactions.getIsSyncing()) {
|
||||
EthoMainGUI.showGeneralError("Transactions sync is currently in progress");
|
||||
} else {
|
||||
// first disable keepInSync
|
||||
EthoTransactions.disableKeepInSync();
|
||||
// then delete the transactions data
|
||||
var counters = EthoDatatabse.getCounters();
|
||||
counters.transactions = 0;
|
||||
EthoDatatabse.setCounters(counters);
|
||||
ipcRenderer.sendSync('deleteTransactions', null);
|
||||
// sync all the transactions to the current block
|
||||
web3Local.eth.getBlock("latest", function(error, localBlock) {
|
||||
if (error) {
|
||||
EthoMainGUI.showGeneralError(error);
|
||||
} else {
|
||||
EthoTransactions.enableKeepInSync();
|
||||
EthoTransactions.syncTransactionsForAllAddresses(localBlock.number);
|
||||
|
||||
iziToast.success({
|
||||
title: 'Success',
|
||||
message: 'Transactions are being resynced',
|
||||
position: 'topRight',
|
||||
timeout: 5000
|
||||
});
|
||||
}
|
||||
});
|
||||
if (isFullySynced) {
|
||||
EthoMainGUI.showGeneralConfirmation("Do you really want to resync transactions?", function(result) {
|
||||
if (result) {
|
||||
if (EthoTransactions.getIsSyncing()) {
|
||||
EthoMainGUI.showGeneralError("Transactions sync is currently in progress");
|
||||
} else {
|
||||
// first disable keepInSync
|
||||
EthoTransactions.disableKeepInSync();
|
||||
// then delete the transactions data
|
||||
var counters = EthoDatatabse.getCounters();
|
||||
counters.transactions = 0;
|
||||
EthoDatatabse.setCounters(counters);
|
||||
ipcRenderer.sendSync('deleteTransactions', null);
|
||||
// sync all the transactions to the current block
|
||||
web3Local.eth.getBlock("latest", function(error, localBlock) {
|
||||
if (error) {
|
||||
EthoMainGUI.showGeneralError(error);
|
||||
} else {
|
||||
EthoTransactions.enableKeepInSync();
|
||||
EthoTransactions.syncTransactionsForAllAddresses(localBlock.number);
|
||||
|
||||
iziToast.success({
|
||||
title: 'Success',
|
||||
message: 'Transactions are being resynced',
|
||||
position: 'topRight',
|
||||
timeout: 5000
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} 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() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user