From e0cdd610dd5d83bbb2f8f94fef8de947320e15aa Mon Sep 17 00:00:00 2001 From: Alan Cohen Date: Fri, 25 Sep 2015 20:53:22 -0700 Subject: [PATCH] Set default max ledger to -1 when requesting account_tx -1 means up to the most recent available _validated_ ledger for ledger_index_max account_tx operates only on valided ledgers --- src/api/ledger/transactions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/ledger/transactions.js b/src/api/ledger/transactions.js index 8d2a4c14..693591bc 100644 --- a/src/api/ledger/transactions.js +++ b/src/api/ledger/transactions.js @@ -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, @@ -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;