! handle the clean transactions correctly before fully synced
! sync all wallets correctly
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Ether1Wallet",
|
"name": "Ether1Wallet",
|
||||||
"version": "0.1.3",
|
"version": "0.2.1",
|
||||||
"description": "Desktop wallet for Ether1 currency",
|
"description": "Desktop wallet for Ether1 currency",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -230,13 +230,15 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsubsribePendingTransactions(clbError, clbSuccess) {
|
unsubsribePendingTransactions(clbError, clbSuccess) {
|
||||||
this.txSubscribe.unsubscribe(function(error, success){
|
if (this.txSubscribe) {
|
||||||
if(error) {
|
this.txSubscribe.unsubscribe(function(error, success){
|
||||||
clbError(error);
|
if(error) {
|
||||||
} else {
|
clbError(error);
|
||||||
clbSuccess(success) ;
|
} else {
|
||||||
}
|
clbSuccess(success) ;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subsribeNewBlockHeaders(clbError, clbSuccess, clbData) {
|
subsribeNewBlockHeaders(clbError, clbSuccess, clbData) {
|
||||||
@@ -254,13 +256,15 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsubsribeNewBlockHeaders(clbError, clbSuccess) {
|
unsubsribeNewBlockHeaders(clbError, clbSuccess) {
|
||||||
this.bhSubscribe.unsubscribe(function(error, success){
|
if (this.bhSubscribe) {
|
||||||
if(error) {
|
this.bhSubscribe.unsubscribe(function(error, success){
|
||||||
clbError(error);
|
if(error) {
|
||||||
} else {
|
clbError(error);
|
||||||
clbSuccess(success) ;
|
} else {
|
||||||
}
|
clbSuccess(success) ;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeConnection() {
|
closeConnection() {
|
||||||
|
|||||||
@@ -12,37 +12,46 @@ class Settings {
|
|||||||
|
|
||||||
$(document).on("render_settings", function() {
|
$(document).on("render_settings", function() {
|
||||||
$("#btnSettingsCleanTransactions").off('click').on('click', function() {
|
$("#btnSettingsCleanTransactions").off('click').on('click', function() {
|
||||||
EthoMainGUI.showGeneralConfirmation("Do you really want to resync transactions?", function(result) {
|
if (isFullySynced) {
|
||||||
if (result) {
|
EthoMainGUI.showGeneralConfirmation("Do you really want to resync transactions?", function(result) {
|
||||||
if (EthoTransactions.getIsSyncing()) {
|
if (result) {
|
||||||
EthoMainGUI.showGeneralError("Transactions sync is currently in progress");
|
if (EthoTransactions.getIsSyncing()) {
|
||||||
} else {
|
EthoMainGUI.showGeneralError("Transactions sync is currently in progress");
|
||||||
// first disable keepInSync
|
} else {
|
||||||
EthoTransactions.disableKeepInSync();
|
// first disable keepInSync
|
||||||
// then delete the transactions data
|
EthoTransactions.disableKeepInSync();
|
||||||
var counters = EthoDatatabse.getCounters();
|
// then delete the transactions data
|
||||||
counters.transactions = 0;
|
var counters = EthoDatatabse.getCounters();
|
||||||
EthoDatatabse.setCounters(counters);
|
counters.transactions = 0;
|
||||||
ipcRenderer.sendSync('deleteTransactions', null);
|
EthoDatatabse.setCounters(counters);
|
||||||
// sync all the transactions to the current block
|
ipcRenderer.sendSync('deleteTransactions', null);
|
||||||
web3Local.eth.getBlock("latest", function(error, localBlock) {
|
// sync all the transactions to the current block
|
||||||
if (error) {
|
web3Local.eth.getBlock("latest", function(error, localBlock) {
|
||||||
EthoMainGUI.showGeneralError(error);
|
if (error) {
|
||||||
} else {
|
EthoMainGUI.showGeneralError(error);
|
||||||
EthoTransactions.enableKeepInSync();
|
} else {
|
||||||
EthoTransactions.syncTransactionsForAllAddresses(localBlock.number);
|
EthoTransactions.enableKeepInSync();
|
||||||
|
EthoTransactions.syncTransactionsForAllAddresses(localBlock.number);
|
||||||
|
|
||||||
iziToast.success({
|
iziToast.success({
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
message: 'Transactions are being resynced',
|
message: 'Transactions are being resynced',
|
||||||
position: 'topRight',
|
position: 'topRight',
|
||||||
timeout: 5000
|
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() {
|
$("#btnSettingsCleanWallets").off('click').on('click', function() {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ SyncProgress = new ProgressBar.Line('#syncProgress',
|
|||||||
|
|
||||||
// set initial value for the progress text
|
// set initial value for the progress text
|
||||||
SyncProgress.setText("Waiting for blockchain, please wait...");
|
SyncProgress.setText("Waiting for blockchain, please wait...");
|
||||||
|
isFullySynced = false;
|
||||||
|
|
||||||
var peerCountInterval = setInterval(function()
|
var peerCountInterval = setInterval(function()
|
||||||
{
|
{
|
||||||
@@ -62,6 +63,7 @@ function StartSyncProcess() {
|
|||||||
// clear the repeat interval and render wallets
|
// clear the repeat interval and render wallets
|
||||||
$(document).trigger("onNewAccountTransaction");
|
$(document).trigger("onNewAccountTransaction");
|
||||||
alreadyCatchedUp = true;
|
alreadyCatchedUp = true;
|
||||||
|
isFullySynced = true;
|
||||||
|
|
||||||
// enable the keep in sync feature
|
// enable the keep in sync feature
|
||||||
EthoTransactions.enableKeepInSync();
|
EthoTransactions.enableKeepInSync();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Transactions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncTransactionsForSingleAddress(addressList, counters, lastBlock, counter) {
|
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]));
|
SyncProgress.setText(vsprintf("Syncing address transactions %d/%d, please wait...", [counter, addressList.length]));
|
||||||
|
|
||||||
var startBlock = parseInt(counters.transactions) || 0;
|
var startBlock = parseInt(counters.transactions) || 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user