summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-05 21:00:41 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-05 21:00:49 +0200
commitbdbd2a464df579c014d71800cf72571dc73ed645 (patch)
tree2c68b7a2b7bc95c2aaca0b4500fc79b4658d7d30 /src/lib
parent60f609135d04ce3bb4ecad6405572bb6d601fa43 (diff)
downloadexchange-bdbd2a464df579c014d71800cf72571dc73ed645.tar.gz
exchange-bdbd2a464df579c014d71800cf72571dc73ed645.tar.bz2
exchange-bdbd2a464df579c014d71800cf72571dc73ed645.zip
no purse fee if purse is successfully merged
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/exchange_api_common.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 59f5bab8a..79e5a31dd 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -399,7 +399,6 @@ parse_merge (struct TALER_EXCHANGE_ReserveHistoryEntry *rh,
const json_t *transaction)
{
uint32_t flags32;
- struct TALER_Amount total;
struct GNUNET_JSON_Specification merge_spec[] = {
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&rh->details.merge_details.h_contract_terms),
@@ -435,21 +434,13 @@ parse_merge (struct TALER_EXCHANGE_ReserveHistoryEntry *rh,
}
rh->details.merge_details.flags =
(enum TALER_WalletAccountMergeFlags) flags32;
- if (0 >
- TALER_amount_add (&total,
- &rh->amount,
- &rh->details.merge_details.purse_fee))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
if (GNUNET_OK !=
TALER_wallet_account_merge_verify (
rh->details.merge_details.merge_timestamp,
&rh->details.merge_details.purse_pub,
rh->details.merge_details.purse_expiration,
&rh->details.merge_details.h_contract_terms,
- &total,
+ &rh->amount,
&rh->details.merge_details.purse_fee,
rh->details.merge_details.min_age,
rh->details.merge_details.flags,
@@ -471,14 +462,17 @@ parse_merge (struct TALER_EXCHANGE_ReserveHistoryEntry *rh,
return GNUNET_SYSERR;
}
}
- if (0 >
- TALER_amount_add (uc->total_out,
- uc->total_out,
- &rh->details.merge_details.purse_fee))
+ else
{
- /* overflow in history already!? inconceivable! Bad exchange! */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
+ if (0 >
+ TALER_amount_add (uc->total_out,
+ uc->total_out,
+ &rh->details.merge_details.purse_fee))
+ {
+ /* overflow in history already!? inconceivable! Bad exchange! */
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
}
return GNUNET_OK;
}