Merge pull request #5126 from matiu/bug/txhistory-cache
Bug/txhistory cache
This commit is contained in:
commit
e5278df480
2 changed files with 12 additions and 2 deletions
1
angular-bitcore-wallet-client/index.js
vendored
1
angular-bitcore-wallet-client/index.js
vendored
|
|
@ -36,6 +36,7 @@ bwcModule.provider("bwcService", function() {
|
||||||
var bwc = new Client({
|
var bwc = new Client({
|
||||||
baseUrl: opts.bwsurl || 'https://bws.bitpay.com/bws/api',
|
baseUrl: opts.bwsurl || 'https://bws.bitpay.com/bws/api',
|
||||||
verbose: opts.verbose,
|
verbose: opts.verbose,
|
||||||
|
timeout: 100000,
|
||||||
transports: ['polling'],
|
transports: ['polling'],
|
||||||
});
|
});
|
||||||
if (walletData)
|
if (walletData)
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
return tx.txid != endingTxid;
|
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) {
|
function getNewTxs(newTxs, skip, cb) {
|
||||||
getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
|
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)));
|
newTxs = newTxs.concat(processNewTxs(wallet, lodash.compact(res)));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue