That's a good approach. Thank you for posting a concrete example.
One difference is that I have used .reverse()
to maintain a consistent descending order. This is important if you want to stop the search based on finding a particular kind of transaction.