make every request a database transaction.

This commit is contained in:
fiatjaf
2020-09-11 14:17:09 -03:00
committed by fiatjaf
parent 487f082eb2
commit 4855e2cd3d
5 changed files with 174 additions and 159 deletions
+2
View File
@@ -48,6 +48,7 @@ def api_payments_create_invoice():
wallet_id=g.wallet.id, amount=g.data["amount"], memo=memo, description_hash=description_hash
)
except Exception as e:
g.db.rollback()
return jsonify({"message": str(e)}), HTTPStatus.INTERNAL_SERVER_ERROR
invoice = bolt11.decode(payment_request)
@@ -75,6 +76,7 @@ def api_payments_pay_invoice():
return jsonify({"message": str(e)}), HTTPStatus.FORBIDDEN
except Exception as e:
print(e)
g.db.rollback()
return jsonify({"message": str(e)}), HTTPStatus.INTERNAL_SERVER_ERROR
return (