Browse Source

force history limit

activeAddress
Matias Alejo Garcia 9 years ago
parent
commit
4eb3caea00
  1. 7
      lib/server.js

7
lib/server.js

@ -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…
Cancel
Save