Optimize orphan transaction handling
Changes suggested by Sergio Demian Lerner to help prevent potential DoS attacks.