Completely rewrite transaction dependency resolution.