public function failTransaction($transaction_id, \Exception $error=null)
    {
        $params = array('status' => 'failed', 'failedTime' => \Tripod\Mongo\DateUtil::getMongoDate());
        if($error!=null)
        {
            $params['error'] = array('reason'=>$error->getMessage(), 'trace'=>$error->getTraceAsString());
        }

        $this->updateTransaction(
            array("_id" => $transaction_id),
            array('$set' => $params),
            array('w' => 1, 'upsert'=>true)
        );
    }