complete detect_outstanding_transaction function