Merge pull request #417 from darkdarkdragon/develop-fix-gettransaction-missing-history

throw MissingLedgerHistoryError in getTransaction only when ledgers a…
This commit is contained in:
Chris Clark
2015-07-13 15:43:06 -07:00

View File

@@ -39,11 +39,13 @@ function getTransaction(identifier, options, callback) {
validate.getTransactionOptions(options);
const remote = this.remote;
const maxLedgerVersion = Math.min(options.maxLedgerVersion,
remote.getLedgerSequence());
function callbackWrapper(error, tx) {
if (error instanceof errors.NotFoundError
&& !utils.hasCompleteLedgerRange(remote,
options.minLedgerVersion, options.maxLedgerVersion)) {
options.minLedgerVersion, maxLedgerVersion)) {
callback(new errors.MissingLedgerHistoryError('Transaction not found,'
+ ' but the server\'s ledger history is incomplete'));
} else if (!error && !isTransactionInRange(tx, options)) {