[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-bank] branch master updated: conflict, when using one reserve pub
From: |
gnunet |
Subject: |
[taler-bank] branch master updated: conflict, when using one reserve pub twice. |
Date: |
Thu, 10 Jun 2021 15:42:15 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new 0556451 conflict, when using one reserve pub twice.
0556451 is described below
commit 0556451225e4990bc2b88c7eb58c65ef531db6aa
Author: MS <ms@taler.net>
AuthorDate: Thu Jun 10 15:42:05 2021 +0200
conflict, when using one reserve pub twice.
---
talerbank/app/views.py | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index d03faee..ad7b2b4 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -905,19 +905,24 @@ def twg_add_incoming(request, user_account, acct_id):
debit_account = BankAccount.objects.get(user=debit_user)
subject = f"{reserve_pub}"
- wtrans = wire_transfer(
- amount,
- debit_account,
- exchange_account,
- subject,
- )
+ # check if reserve pub exists already.
+ try:
+ BankTransactions.objects.get(subject=subject)
- return JsonResponse(
- {
- "row_id": wtrans.id,
- "timestamp": dict(t_ms=(int(wtrans.date.timestamp()) * 1000)),
- }
- )
+ except BankTransactions.DoesNotExist:
+
+ wtrans = wire_transfer(
+ amount,
+ debit_account,
+ exchange_account,
+ return JsonResponse(
+ {
+ "row_id": wtrans.id,
+ "timestamp": dict(t_ms=(int(wtrans.date.timestamp()) * 1000)),
+ }
+ )
+ # Here means this public key was used already: must fail.
+ return HttpResponse(status=409) # CONFLICT.
@csrf_exempt
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-bank] branch master updated: conflict, when using one reserve pub twice.,
gnunet <=