Can you use a queue of to-be-deleted txids instead of recursion here?