force history limit
This commit is contained in:
parent
611b5e53d3
commit
4eb3caea00
|
@ -35,6 +35,7 @@ var blockchainExplorerOpts;
|
|||
var messageBroker;
|
||||
var serviceVersion;
|
||||
|
||||
var HISTORY_LIMIT = 10;
|
||||
|
||||
/**
|
||||
* Creates an instance of the Bitcore Wallet Service.
|
||||
|
@ -1972,6 +1973,10 @@ WalletService.prototype._normalizeTxHistory = function(txs) {
|
|||
WalletService.prototype.getTxHistory = function(opts, cb) {
|
||||
var self = this;
|
||||
|
||||
opts = opts || {};
|
||||
opts.limit = (_.isUndefined(opts.limit) ? HISTORY_LIMIT : opts.limit);
|
||||
if (opts.limit > HISTORY_LIMIT) opts.limit = HISTORY_LIMIT;
|
||||
|
||||
function decorate(txs, addresses, proposals) {
|
||||
|
||||
var indexedAddresses = _.indexBy(addresses, 'address');
|
||||
|
@ -2094,7 +2099,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
|
|||
},
|
||||
function(next) {
|
||||
var from = opts.skip || 0;
|
||||
var to = from + (_.isUndefined(opts.limit) ? 100 : opts.limit);
|
||||
var to = from + opts.limit;
|
||||
bc.getTransactions(addressStrs, from, to, function(err, txs) {
|
||||
if (err) return cb(err);
|
||||
next(null, self._normalizeTxHistory(txs));
|
||||
|
|
Loading…
Reference in New Issue