mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #5126 from matiu/bug/txhistory-cache
Bug/txhistory cache
This commit is contained in:
commit
e5278df480
|
@ -36,6 +36,7 @@ bwcModule.provider("bwcService", function() {
|
|||
var bwc = new Client({
|
||||
baseUrl: opts.bwsurl || 'https://bws.bitpay.com/bws/api',
|
||||
verbose: opts.verbose,
|
||||
timeout: 100000,
|
||||
transports: ['polling'],
|
||||
});
|
||||
if (walletData)
|
||||
|
|
|
@ -312,7 +312,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
return tx.txid != endingTxid;
|
||||
});
|
||||
|
||||
return cb(null, res, res.length == limit);
|
||||
return cb(null, res, res.length >= limit);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -403,7 +403,16 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
function getNewTxs(newTxs, skip, cb) {
|
||||
getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
|
||||
if (err) return cb(err);
|
||||
if (err) {
|
||||
$log.warn('BWS Error:' + err); //TODO
|
||||
if (err instanceof errors.CONNECTION_ERROR || (err.message && err.message.match(/5../))) {
|
||||
log.info('Retrying history download in 5 secs...');
|
||||
return $timeout(function() {
|
||||
return getNewTxs(newTxs, skip, cb);
|
||||
}, 5000);
|
||||
};
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
newTxs = newTxs.concat(processNewTxs(wallet, lodash.compact(res)));
|
||||
|
||||
|
|
Loading…
Reference in New Issue