rm TX history after scan

This commit is contained in:
Matias Alejo Garcia 2015-11-12 17:08:24 -03:00
parent 0678a7aa72
commit aeb7766b93
2 changed files with 11 additions and 5 deletions

View File

@ -796,7 +796,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) { self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
if (err) return i_cb(err); if (err) return i_cb(err);
newTxs = newTxs.concat(lodash.compact(res)); newTxs = newTxs.concat(lodash.compact(res));
skip = skip + requestLimit; skip = skip + requestLimit;
@ -820,7 +819,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
getNewTxs([], 0, function(err, txs) { getNewTxs([], 0, function(err, txs) {
if (err) return cb(err); if (err) return cb(err);
var newHistory = lodash.compact(txs.concat(txsFromLocal)); var newHistory = lodash.compact(txs.concat(txsFromLocal));
$log.debug('Tx History synced. Total Txs: ' + newHistory.length); $log.debug('Tx History synced. Total Txs: ' + newHistory.length);
@ -1071,7 +1069,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('Local/ClearHistory', function(event) { $rootScope.$on('Local/ClearHistory', function(event) {
$log.debug('The wallet transaction history has been deleted'); $log.debug('The wallet transaction history has been deleted');
self.txHistory = []; self.txHistory = self.completeHistory = [];
self.updateHistory(); self.updateHistory();
}); });
@ -1200,7 +1198,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$log.debug('Backup done stored'); $log.debug('Backup done stored');
addressService.expireAddress(walletId, function(err) { addressService.expireAddress(walletId, function(err) {
$timeout(function() { $timeout(function() {
self.txHistory = self.completeHistory = [];
storageService.removeTxHistory(walletId, function() {
self.startScan(walletId); self.startScan(walletId);
});
}, 500); }, 500);
}); });
}); });
@ -1258,6 +1259,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
}); });
$rootScope.$on('ScanFinished', function() {
console.log('Scan Finished. Updating history');
storageService.removeTxHistory(self.walletId, function() {
self.updateHistory();
});
});
lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) { lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) {
$rootScope.$on(eventName, function() { $rootScope.$on(eventName, function() {

View File

@ -100,7 +100,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
$log.error(err); $log.error(err);
return; return;
} }
$scope.$emit('Local/ClearHistory'); $scope.$emit('Local/ClearHistory');
$timeout(function() { $timeout(function() {