Implement a transaction retry helper.