aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_common.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-22 18:21:15 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-22 18:21:15 +0200
commit40daa209fb0fb5292956fd3f5770a90e8da0c2a6 (patch)
tree18e2bd458c6bf9e640b17feba35f51d2d79c5cf0 /src/lib/exchange_api_common.c
parent8658ae03cab72142b2376d5318e039320b02913a (diff)
downloadexchange-40daa209fb0fb5292956fd3f5770a90e8da0c2a6.tar.xz
-more work on reverse history
Diffstat (limited to 'src/lib/exchange_api_common.c')
-rw-r--r--src/lib/exchange_api_common.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 04f2a4df8..e3eb4caad 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2021 Taler Systems SA
+ Copyright (C) 2015-2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -26,6 +26,8 @@
#include "taler_signatures.h"
+// FIXME: refactor, use switching table instead
+// of long if-then-else-else-else list!
enum GNUNET_GenericReturnValue
TALER_EXCHANGE_parse_reserve_history (
struct TALER_EXCHANGE_Handle *exchange,
@@ -340,6 +342,34 @@ TALER_EXCHANGE_parse_reserve_history (
}
/* end type==CLOSING */
}
+ else if (0 == strcasecmp (type,
+ "MERGE"))
+ {
+ GNUNET_break (0); // FIXME: implement!
+ if (0 >
+ TALER_amount_add (total_in,
+ total_in,
+ &rh->amount))
+ {
+ /* overflow in history already!? inconceivable! Bad exchange! */
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ }
+ else if (0 == strcasecmp (type,
+ "HISTORY"))
+ {
+ GNUNET_break (0); // FIXME: implement!
+ if (0 >
+ TALER_amount_add (total_out,
+ total_out,
+ &amount))
+ {
+ /* overflow in history already!? inconceivable! Bad exchange! */
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ }
else
{
/* unexpected 'type', protocol incompatibility, complain! */
@@ -369,6 +399,10 @@ TALER_EXCHANGE_free_reserve_history (
break;
case TALER_EXCHANGE_RTT_CLOSE:
break;
+ case TALER_EXCHANGE_RTT_HISTORY:
+ break;
+ case TALER_EXCHANGE_RTT_MERGE:
+ break;
}
}
GNUNET_free (rhistory);