for x starting at 0 and increasing by 1 until the result matches a transaction I've already encountered before
Genius!
Not really ... Not only, he generates lots of RPC calls, but he will also miss transactions if a new transaction comes in while he increments X ...
Example:
bitcoind listtransactions "*" 1 0
{... hash: "fe46e7a8..."' }
bitcoind listtransactions "*" 1 1
{... hash: "fe46e7a8..."' }
So, you would break here although, there could be another new transaction after the hash you already know ...
Imho this listtransaction model is crap ... it make things much more difficulty than it has to be. The newest transaction is always at index 0 is stupid ...