api/notifications.js
function getNextAndPreviousTransactions(numTransactionsInLedger, callback) {
    async.concat([false, true], function(earliestFirst, concat_callback) {
      var params = {
        account: notificationDetails.account,
        max: numTransactionsInLedger + 1,
        min: numTransactionsInLedger + 1,
        limit: numTransactionsInLedger + 1,
        earliestFirst: earliestFirst
      };

      // In rippled -1 corresponds to the first or last ledger
      // in its database, depending on whether it is the min or max value
      if (params.earliestFirst) {
        params.ledger_index_max = -1;
        params.ledger_index_min = notificationDetails.transaction.ledger_index;
      } else {
        params.ledger_index_max = notificationDetails.transaction.ledger_index;
        params.ledger_index_min = -1;
      }

      transactions.getAccountTransactions(api, params, concat_callback);

    }, callback);

  }
function getNextAndPreviousTransactions(numTransactionsInLedger, callback) {
    async.concat([false, true], function(earliestFirst, concat_callback) {
      var params = {
        account: notificationDetails.account,
        max: numTransactionsInLedger + 1,
        min: numTransactionsInLedger + 1,
        limit: numTransactionsInLedger + 1,
        earliestFirst: earliestFirst
      };

      // In rippled -1 corresponds to the first or last ledger
      // in its database, depending on whether it is the min or max value
      if (params.earliestFirst) {
        params.ledger_index_max = -1;
        params.ledger_index_min = notificationDetails.transaction.ledger_index;
      } else {
        params.ledger_index_max = notificationDetails.transaction.ledger_index;
        params.ledger_index_min = -1;
      }

      transactions.getAccountTransactions(api, params, concat_callback);

    }, callback);

  }
function getNextAndPreviousTransactions ( numTransactionsInLedger , callback ) { async . concat ( [ false , true ] , function ( earliestFirst , concat_callback ) { var params = { account : notificationDetails . account , max : numTransactionsInLedger + 1 , min : numTransactionsInLedger + 1 , limit : numTransactionsInLedger + 1 , earliestFirst : earliestFirst } ; // In rippled -1 corresponds to the first or last ledger // in its database, depending on whether it is the min or max value if ( params . earliestFirst ) { params . ledger_index_max = - 1 ; params . ledger_index_min = notificationDetails . transaction . ledger_index ; } else { params . ledger_index_max = notificationDetails . transaction . ledger_index ; params . ledger_index_min = - 1 ; } transactions . getAccountTransactions ( api , params , concat_callback ) ; } , callback ) ; }
Query for one more than the numTransactionsInLedger going forward and backwards to get a range of transactions that will definitely include the next and previous transactions
Query for one more than the numTransactionsInLedger going forward and backwards to get a range of transactions that will definitely include the next and previous transactions