Skip to content

Commit

Permalink
Set default max ledger to -1 when requesting account_tx
Browse files Browse the repository at this point in the history
-1 means up to the most recent available _validated_ ledger for ledger_index_max

account_tx operates only on valided ledgers
  • Loading branch information
Alan Cohen committed Sep 28, 2015
1 parent 62a2d2a commit e0cdd61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/ledger/transactions.js
Expand Up @@ -70,7 +70,9 @@ function formatPartialResponse(address, options, data) {
function getAccountTx(remote, address, options, marker, limit, callback) {
const params = {
account: address,
// -1 is equivalent to earliest available validated ledger
ledger_index_min: options.minLedgerVersion || -1,
// -1 is equivalent to most recent available validated ledger
ledger_index_max: options.maxLedgerVersion || -1,
forward: options.earliestFirst,
binary: options.binary,
Expand Down Expand Up @@ -121,7 +123,7 @@ function getTransactionsAsync(account, options, callback) {
validate.address(account);
validate.getTransactionsOptions(options);

const defaults = {maxLedgerVersion: this.remote.getLedgerSequence()};
const defaults = {maxLedgerVersion: -1};
if (options.start) {
getTransaction.call(this, options.start).then(tx => {
const ledgerVersion = tx.outcome.ledgerVersion;
Expand Down

0 comments on commit e0cdd61

Please sign in to comment.