remove history cache from export

This commit is contained in:
Gabriel Bazán 2016-06-17 11:46:40 -03:00 committed by Gustavo Maximiliano Cortez
commit b433120121
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
4 changed files with 11 additions and 52 deletions

View file

@ -40,7 +40,7 @@ angular.module('copayApp.services')
var a = angular.element('<a></a>');
var blob = new NewBlob(ew, 'text/plain;charset=utf-8');
a.attr('href',window.URL.createObjectURL(blob));
a.attr('href', window.URL.createObjectURL(blob));
a.attr('download', filename);
a[0].click();
return cb();
@ -49,7 +49,6 @@ angular.module('copayApp.services')
root.addMetadata = function(b, opts) {
b = JSON.parse(b);
if (opts.historyCache) b.historyCache = opts.historyCache;
if (opts.addressBook) b.addressBook = opts.addressBook;
return JSON.stringify(b);
}
@ -62,7 +61,7 @@ angular.module('copayApp.services')
try {
opts = opts || {};
var b = fc.export(opts);
if (opts.historyCache || opts.addressBook) b = root.addMetadata(b, opts);
if (opts.addressBook) b = root.addMetadata(b, opts);
var e = sjcl.encrypt(password, b, {
iter: 10000

View file

@ -464,7 +464,7 @@ angular.module('copayApp.services')
});
};
root.setMetaData = function(walletClient, addressBook, historyCache, cb) {
root.setMetaData = function(walletClient, addressBook, cb) {
storageService.getAddressbook(walletClient.credentials.network, function(err, localAddressBook) {
var localAddressBook1 = {};
try {
@ -475,10 +475,7 @@ angular.module('copayApp.services')
var mergeAddressBook = lodash.merge(addressBook, localAddressBook1);
storageService.setAddressbook(walletClient.credentials.network, JSON.stringify(addressBook), function(err) {
if (err) return cb(err);
storageService.setTxHistory(JSON.stringify(historyCache), walletClient.credentials.walletId, function(err) {
if (err) return cb(err);
return cb(null);
});
return cb(null);
});
});
}
@ -563,13 +560,12 @@ angular.module('copayApp.services')
str = JSON.parse(str);
var addressBook = str.addressBook || {};
var historyCache = str.historyCache ||  [];
root.addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl
}, function(err, walletId) {
if (err) return cb(err);
root.setMetaData(walletClient, addressBook, historyCache, function(error) {
root.setMetaData(walletClient, addressBook, function(error) {
if (error) $log.warn(error);
return cb(err, walletId);
});