commit 4621e2ea42eed868fa842889a32c7f90b52a863f
parent c6a10b52461f7781ac3e9c6aeb467ecbd7bdad38
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 20 Jun 2020 19:49:26 +0200
add amount checks
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_reserves.c b/src/backend/taler-merchant-httpd_reserves.c
@@ -179,6 +179,27 @@ reserve_cb (void *cls,
try_later (r);
return;
}
+ if (0 !=
+ TALER_amount_cmp_currency (&r->expected_amount,
+ balance))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Reserve currency disagreement: exchange `%s' has %s, expected %s\n",
+ r->exchange_url,
+ balance->currency,
+ r->expected_amount.currency);
+ free_reserve (r);
+ return;
+ }
+ if (0 !=
+ TALER_amount_cmp (&r->expected_amount,
+ balance))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Reserve initial balance disagreement: exchange `%s' received `%s'\n",
+ r->exchange_url,
+ TALER_amount2s (balance));
+ }
qs = TMH_db->activate_reserve (TMH_db->cls,
r->instance_id,
&r->reserve_pub,