gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-deployment] branch master updated: fix amount check


From: gnunet
Subject: [taler-deployment] branch master updated: fix amount check
Date: Fri, 02 Jul 2021 15:51:37 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 70f6de4  fix amount check
70f6de4 is described below

commit 70f6de4059d29764941f7a759cee462d09f10039
Author: ms <ms@taler.net>
AuthorDate: Fri Jul 2 15:51:33 2021 +0200

    fix amount check
---
 buildbot/check_tip_reserve.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/buildbot/check_tip_reserve.py b/buildbot/check_tip_reserve.py
index ef821fa..320c614 100755
--- a/buildbot/check_tip_reserve.py
+++ b/buildbot/check_tip_reserve.py
@@ -24,6 +24,7 @@ def expect_env(name):
 
 MERCHANT_BACKEND_BASE_URL = expect_env("TALER_ENV_MERCHANT_BACKEND")
 TALER_ENV_FRONTENDS_APITOKEN = expect_env("TALER_ENV_FRONTENDS_APITOKEN")
+TALER_CONFIG_CURRENCY = expect_env("TALER_CONFIG_CURRENCY")
 
 resp = requests.get(
     urljoin(MERCHANT_BACKEND_BASE_URL,
@@ -40,15 +41,21 @@ if len(reserves) == 0:
     print("merchant backend has NO tip reserves active!")
     exit(1)
 
-max_amount = Amount.parse(reserves[0].get("committed_amount"))
+max_amount = Amount(TALER_CONFIG_CURRENCY, 0, 0)
 for item in reserves[1:]:
-    item_amount = Amount.parse(item.get("committed_amount"))
-    if item_amount > max_amount:
-        max_amount = item_amount
+    committed_amount = Amount.parse(item.get("committed_amount"))
+    allocated_amount = Amount.parse(item.get("merchant_initial_amount"))
+    confirmed_amount = Amount.parse(item.get("exchange_initial_amount"))
+    if allocated_amount != confirmed_amount:
+        print("The exchange never confirmed the tip reserve amount!")
+        exit(1)
+    remaining_amount = allocated_amount - committed_amount
+    if remaining_amount > max_amount:
+        max_amount = remaining_amount
 
 # FIXME, eventually, just check the largest amount left through
 # all the reserves.
 print(f"Largest tip reserve: {max_amount}")
-print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
+print("\n\n\n\n\n\n\n")
 print(f"=========================================")
 print(f"FULL DUMP FROM THE BACKEND:\n{resp.text}")

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]