Get all results when limit is not specified

This commit is contained in:
Chris Clark
2015-07-08 15:13:20 -07:00
parent a464ca2368
commit f3a54bf02a
4 changed files with 14 additions and 13 deletions

View File

@@ -5,7 +5,6 @@ const parseTransaction = require('./parse/transaction');
const getTransaction = require('./transaction');
const validate = utils.common.validate;
const composeAsync = utils.common.composeAsync;
const DEFAULT_LIMIT = 100;
function parseAccountTxTransaction(tx) {
// rippled uses a different response format for 'account_tx' than 'tx'
@@ -43,7 +42,7 @@ function getAccountTx(remote, address, options, marker, limit, callback) {
ledger_index_max: options.maxLedgerVersion || -1,
forward: options.earliestFirst,
binary: options.binary,
limit: Math.max(limit || DEFAULT_LIMIT, 10),
limit: utils.clamp(limit, 10, 400),
marker: marker
};
@@ -60,11 +59,10 @@ function getAccountTx(remote, address, options, marker, limit, callback) {
}
function getTransactionsInternal(remote, address, options, callback) {
const limit = options.limit || DEFAULT_LIMIT;
const compare = options.earliestFirst ? utils.compareTransactions :
_.rearg(utils.compareTransactions, 1, 0);
const getter = _.partial(getAccountTx, remote, address, options);
utils.getRecursive(getter, limit,
utils.getRecursive(getter, options.limit,
composeAsync((txs) => txs.sort(compare), callback));
}