LCOV - code coverage report
Current view: top level - exchange - taler-exchange-httpd_deposit.c (source / functions) Hit Total Coverage
Test: rcoverage.info Lines: 102 145 70.3 %
Date: 2017-09-17 17:24:28 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2014-2017 Inria and GNUnet e.V.
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify it under the
       6             :   terms of the GNU Affero General Public License as published by the Free Software
       7             :   Foundation; either version 3, or (at your option) any later version.
       8             : 
       9             :   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
      10             :   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
      11             :   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
      12             : 
      13             :   You should have received a copy of the GNU Affero General Public License along with
      14             :   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
      15             : */
      16             : /**
      17             :  * @file taler-exchange-httpd_deposit.c
      18             :  * @brief Handle /deposit requests; parses the POST and JSON and
      19             :  *        verifies the coin signature before handing things off
      20             :  *        to the database.
      21             :  * @author Florian Dold
      22             :  * @author Benedikt Mueller
      23             :  * @author Christian Grothoff
      24             :  */
      25             : #include "platform.h"
      26             : #include <gnunet/gnunet_util_lib.h>
      27             : #include <gnunet/gnunet_json_lib.h>
      28             : #include <jansson.h>
      29             : #include <microhttpd.h>
      30             : #include <pthread.h>
      31             : #include "taler_json_lib.h"
      32             : #include "taler-exchange-httpd_parsing.h"
      33             : #include "taler-exchange-httpd_deposit.h"
      34             : #include "taler-exchange-httpd_responses.h"
      35             : #include "taler-exchange-httpd_keystate.h"
      36             : #include "taler-exchange-httpd_validation.h"
      37             : 
      38             : 
      39             : /**
      40             :  * Send confirmation of deposit success to client.  This function
      41             :  * will create a signed message affirming the given information
      42             :  * and return it to the client.  By this, the exchange affirms that
      43             :  * the coin had sufficient (residual) value for the specified
      44             :  * transaction and that it will execute the requested deposit
      45             :  * operation with the given wiring details.
      46             :  *
      47             :  * @param connection connection to the client
      48             :  * @param coin_pub public key of the coin
      49             :  * @param h_wire hash of wire details
      50             :  * @param h_contract_terms hash of contract details
      51             :  * @param timestamp client's timestamp
      52             :  * @param refund_deadline until when this deposit be refunded
      53             :  * @param merchant merchant public key
      54             :  * @param amount_without_fee fraction of coin value to deposit, without the fee
      55             :  * @return MHD result code
      56             :  */
      57             : static int
      58           7 : reply_deposit_success (struct MHD_Connection *connection,
      59             :                        const struct TALER_CoinSpendPublicKeyP *coin_pub,
      60             :                        const struct GNUNET_HashCode *h_wire,
      61             :                        const struct GNUNET_HashCode *h_contract_terms,
      62             :                        struct GNUNET_TIME_Absolute timestamp,
      63             :                        struct GNUNET_TIME_Absolute refund_deadline,
      64             :                        const struct TALER_MerchantPublicKeyP *merchant,
      65             :                        const struct TALER_Amount *amount_without_fee)
      66             : {
      67             :   struct TALER_DepositConfirmationPS dc;
      68             :   struct TALER_ExchangePublicKeyP pub;
      69             :   struct TALER_ExchangeSignatureP sig;
      70             : 
      71           7 :   dc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT);
      72           7 :   dc.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
      73           7 :   dc.h_contract_terms = *h_contract_terms;
      74           7 :   dc.h_wire = *h_wire;
      75           7 :   dc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
      76           7 :   dc.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
      77           7 :   TALER_amount_hton (&dc.amount_without_fee,
      78             :                      amount_without_fee);
      79           7 :   dc.coin_pub = *coin_pub;
      80           7 :   dc.merchant = *merchant;
      81           7 :   TEH_KS_sign (&dc.purpose,
      82             :                &pub,
      83             :                &sig);
      84           7 :   return TEH_RESPONSE_reply_json_pack (connection,
      85             :                                        MHD_HTTP_OK,
      86             :                                        "{s:s, s:o, s:o}",
      87             :                                        "status", "DEPOSIT_OK",
      88             :                                        "sig", GNUNET_JSON_from_data_auto (&sig),
      89             :                                        "pub", GNUNET_JSON_from_data_auto (&pub));
      90             : }
      91             : 
      92             : 
      93             : /**
      94             :  * Closure for #deposit_transaction.
      95             :  */
      96             : struct DepositContext
      97             : {
      98             :   /**
      99             :    * Information about the deposit request.
     100             :    */
     101             :   const struct TALER_EXCHANGEDB_Deposit *deposit;
     102             : 
     103             :   /**
     104             :    * Value of the coin.
     105             :    */
     106             :   struct TALER_Amount value;
     107             :   
     108             : };
     109             : 
     110             : 
     111             : /**
     112             :  * Execute database transaction for /deposit.  Runs the transaction
     113             :  * logic; IF it returns a non-error code, the transaction logic MUST
     114             :  * NOT queue a MHD response.  IF it returns an hard error, the
     115             :  * transaction logic MUST queue a MHD response and set @a mhd_ret.  IF
     116             :  * it returns the soft error code, the function MAY be called again to
     117             :  * retry and MUST not queue a MHD response.
     118             :  *
     119             :  * @param cls a `struct DepositContext`
     120             :  * @param connection MHD request context
     121             :  * @param session database session and transaction to use
     122             :  * @param[out] mhd_ret set to MHD status on error
     123             :  * @return transaction status
     124             :  */
     125             : static enum GNUNET_DB_QueryStatus
     126          10 : deposit_transaction (void *cls,
     127             :                      struct MHD_Connection *connection,
     128             :                      struct TALER_EXCHANGEDB_Session *session,
     129             :                      int *mhd_ret)
     130             : {
     131          10 :   struct DepositContext *dc = cls;
     132          10 :   const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit;
     133             :   struct TALER_EXCHANGEDB_TransactionList *tl;
     134             :   struct TALER_Amount spent;
     135             :   enum GNUNET_DB_QueryStatus qs;
     136             :   
     137          10 :   qs = TEH_plugin->have_deposit (TEH_plugin->cls,
     138             :                                  session,
     139             :                                  deposit);
     140          10 :   if (qs < 0)
     141           0 :     return qs;
     142          10 :   if (1 == qs)
     143             :   {
     144             :     struct TALER_Amount amount_without_fee;
     145             : 
     146           0 :     GNUNET_assert (GNUNET_OK ==
     147             :                    TALER_amount_subtract (&amount_without_fee,
     148             :                                           &deposit->amount_with_fee,
     149             :                                           &deposit->deposit_fee));
     150           0 :     *mhd_ret = reply_deposit_success (connection,
     151             :                                       &deposit->coin.coin_pub,
     152             :                                       &deposit->h_wire,
     153             :                                       &deposit->h_contract_terms,
     154             :                                       deposit->timestamp,
     155             :                                       deposit->refund_deadline,
     156             :                                       &deposit->merchant_pub,
     157             :                                       &amount_without_fee);
     158             :     /* Treat as 'hard' DB error as we want to rollback and
     159             :        never try again. */
     160           0 :     return GNUNET_DB_STATUS_HARD_ERROR;
     161             :   }
     162             : 
     163             :   /* Start with fee for THIS transaction */
     164          10 :   spent = deposit->amount_with_fee;
     165             :   /* add cost of all previous transactions */
     166          10 :   qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
     167             :                                           session,
     168             :                                           &deposit->coin.coin_pub,
     169             :                                           &tl);
     170          10 :   if (0 > qs)
     171           0 :     return qs;
     172          10 :   if (GNUNET_OK !=
     173          10 :       TEH_DB_calculate_transaction_list_totals (tl,
     174             :                                                 &spent,
     175             :                                                 &spent))
     176             :   {
     177           0 :     TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
     178             :                                             tl);
     179           0 :     *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
     180             :                                                      TALER_EC_DEPOSIT_HISTORY_DB_ERROR);
     181           0 :     return GNUNET_DB_STATUS_HARD_ERROR;
     182             :   }
     183             :   /* Check that cost of all transactions is smaller than
     184             :      the value of the coin. */
     185          10 :   if (0 < TALER_amount_cmp (&spent,
     186          10 :                             &dc->value))
     187             :   {
     188           3 :     *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection,
     189             :                                                            TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS,
     190             :                                                            tl);
     191           3 :     TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
     192             :                                             tl);
     193           3 :     return GNUNET_DB_STATUS_HARD_ERROR;
     194             :   }
     195           7 :   TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
     196             :                                           tl);
     197           7 :   qs = TEH_plugin->insert_deposit (TEH_plugin->cls,
     198             :                                    session,
     199             :                                    deposit);
     200           7 :   if (GNUNET_DB_STATUS_HARD_ERROR == qs)
     201             :   {
     202           0 :     TALER_LOG_WARNING ("Failed to store /deposit information in database\n");
     203           0 :     *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
     204             :                                                      TALER_EC_DEPOSIT_STORE_DB_ERROR);
     205             :   }
     206           7 :   return qs;
     207             : }
     208             : 
     209             : 
     210             : /**
     211             :  * We have parsed the JSON information about the deposit, do some
     212             :  * basic sanity checks (especially that the signature on the coin is
     213             :  * valid, and that this type of coin exists) and then execute the
     214             :  * deposit.
     215             :  *
     216             :  * @param connection the MHD connection to handle
     217             :  * @param deposit information about the deposit
     218             :  * @return MHD result code
     219             :  */
     220             : static int
     221          10 : verify_and_execute_deposit (struct MHD_Connection *connection,
     222             :                             const struct TALER_EXCHANGEDB_Deposit *deposit)
     223             : {
     224             :   struct TALER_DepositRequestPS dr;
     225             :   int mhd_ret;
     226             :   struct TALER_Amount amount_without_fee;
     227             :   struct DepositContext dc;
     228             :   struct TEH_KS_StateHandle *mks;
     229             :   struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
     230             : 
     231             :   /* check signature */
     232          10 :   dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
     233          10 :   dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
     234          10 :   dr.h_contract_terms = deposit->h_contract_terms;
     235          10 :   dr.h_wire = deposit->h_wire;
     236          10 :   dr.timestamp = GNUNET_TIME_absolute_hton (deposit->timestamp);
     237          10 :   dr.refund_deadline = GNUNET_TIME_absolute_hton (deposit->refund_deadline);
     238          10 :   TALER_amount_hton (&dr.amount_with_fee,
     239             :                      &deposit->amount_with_fee);
     240          10 :   TALER_amount_hton (&dr.deposit_fee,
     241             :                      &deposit->deposit_fee);
     242          10 :   dr.merchant = deposit->merchant_pub;
     243          10 :   dr.coin_pub = deposit->coin.coin_pub;
     244          10 :   if (GNUNET_OK !=
     245          10 :       GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_DEPOSIT,
     246             :                                   &dr.purpose,
     247             :                                   &deposit->csig.eddsa_signature,
     248             :                                   &deposit->coin.coin_pub.eddsa_pub))
     249             :   {
     250           0 :     TALER_LOG_WARNING ("Invalid signature on /deposit request\n");
     251           0 :     return TEH_RESPONSE_reply_signature_invalid (connection,
     252             :                                                  TALER_EC_DEPOSIT_COIN_SIGNATURE_INVALID,
     253             :                                                  "coin_sig");
     254             :   }
     255             : 
     256             :   /* check denomination */
     257          10 :   mks = TEH_KS_acquire ();
     258          10 :   dki = TEH_KS_denomination_key_lookup (mks,
     259             :                                         &deposit->coin.denom_pub,
     260             :                                         TEH_KS_DKU_DEPOSIT);
     261          10 :   if (NULL == dki)
     262             :   {
     263           0 :     TEH_KS_release (mks);
     264           0 :     return TEH_RESPONSE_reply_internal_db_error (connection,
     265             :                                                  TALER_EC_DEPOSIT_DB_DENOMINATION_KEY_UNKNOWN);
     266             :   }
     267          10 :   TALER_amount_ntoh (&dc.value,
     268          10 :                      &dki->issue.properties.value);
     269          10 :   TEH_KS_release (mks);
     270             : 
     271             :   /* execute transaction */
     272          10 :   dc.deposit = deposit;
     273          10 :   if (GNUNET_OK !=
     274          10 :       TEH_DB_run_transaction (connection,
     275             :                               &mhd_ret,
     276             :                               &deposit_transaction,
     277             :                               &dc))
     278           3 :     return mhd_ret;
     279             : 
     280             :   /* generate regular response */
     281           7 :   GNUNET_assert (GNUNET_SYSERR !=
     282             :                  TALER_amount_subtract (&amount_without_fee,
     283             :                                         &deposit->amount_with_fee,
     284             :                                         &deposit->deposit_fee));
     285           7 :   return reply_deposit_success (connection,
     286             :                                 &deposit->coin.coin_pub,
     287             :                                 &deposit->h_wire,
     288             :                                 &deposit->h_contract_terms,
     289             :                                 deposit->timestamp,
     290             :                                 deposit->refund_deadline,
     291             :                                 &deposit->merchant_pub,
     292             :                                 &amount_without_fee);
     293             : }
     294             : 
     295             : 
     296             : /**
     297             :  * Check that @a ts is reasonably close to our own RTC.
     298             :  *
     299             :  * @param ts timestamp to check
     300             :  * @return #GNUNET_OK if @a ts is reasonable
     301             :  */
     302             : static int
     303          12 : check_timestamp_current (struct GNUNET_TIME_Absolute ts)
     304             : {
     305             :   struct GNUNET_TIME_Relative r;
     306             :   struct GNUNET_TIME_Relative tolerance;
     307             : 
     308             :   /* Let's be VERY generous */
     309          12 :   tolerance = GNUNET_TIME_UNIT_MONTHS;
     310          12 :   r = GNUNET_TIME_absolute_get_duration (ts);
     311          12 :   if (r.rel_value_us > tolerance.rel_value_us)
     312             :   {
     313           0 :     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
     314             :                 "Deposit timestamp too old: %llu vs %llu > %llu\n",
     315             :                 (unsigned long long) ts.abs_value_us,
     316             :                 (unsigned long long) GNUNET_TIME_absolute_get().abs_value_us,
     317             :                 (unsigned long long) tolerance.rel_value_us);
     318           0 :     return GNUNET_SYSERR;
     319             :   }
     320          12 :   r = GNUNET_TIME_absolute_get_remaining (ts);
     321          12 :   if (r.rel_value_us > tolerance.rel_value_us)
     322             :   {
     323           0 :     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
     324             :                 "Deposit timestamp too new: %llu vs %llu < - %llu\n",
     325             :                 (unsigned long long) ts.abs_value_us,
     326             :                 (unsigned long long) GNUNET_TIME_absolute_get().abs_value_us,
     327             :                 (unsigned long long) tolerance.rel_value_us);
     328           0 :     return GNUNET_SYSERR;
     329             :   }
     330          12 :   return GNUNET_OK;
     331             : }
     332             : 
     333             : 
     334             : /**
     335             :  * Handle a "/deposit" request.  Parses the JSON, and, if successful,
     336             :  * passes the JSON data to #verify_and_execute_deposit() to further
     337             :  * check the details of the operation specified.  If everything checks
     338             :  * out, this will ultimately lead to the "/deposit" being executed, or
     339             :  * rejected.
     340             :  *
     341             :  * @param rh context of the handler
     342             :  * @param connection the MHD connection to handle
     343             :  * @param[in,out] connection_cls the connection's closure (can be updated)
     344             :  * @param upload_data upload data
     345             :  * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
     346             :  * @return MHD result code
     347             :   */
     348             : int
     349          36 : TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
     350             :                              struct MHD_Connection *connection,
     351             :                              void **connection_cls,
     352             :                              const char *upload_data,
     353             :                              size_t *upload_data_size)
     354             : {
     355             :   json_t *json;
     356             :   int res;
     357             :   json_t *wire;
     358             :   char *emsg;
     359             :   enum TALER_ErrorCode ec;
     360             :   struct TALER_EXCHANGEDB_Deposit deposit;
     361             :   struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
     362             :   struct TEH_KS_StateHandle *key_state;
     363             :   struct GNUNET_HashCode my_h_wire;
     364          36 :   struct GNUNET_JSON_Specification spec[] = {
     365             :     GNUNET_JSON_spec_json ("wire", &wire),
     366             :     TALER_JSON_spec_amount ("f", &deposit.amount_with_fee),
     367             :     TALER_JSON_spec_denomination_public_key ("denom_pub", &deposit.coin.denom_pub),
     368             :     TALER_JSON_spec_denomination_signature ("ub_sig", &deposit.coin.denom_sig),
     369             :     GNUNET_JSON_spec_fixed_auto ("coin_pub", &deposit.coin.coin_pub),
     370             :     GNUNET_JSON_spec_fixed_auto ("merchant_pub", &deposit.merchant_pub),
     371             :     GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &deposit.h_contract_terms),
     372             :     GNUNET_JSON_spec_fixed_auto ("H_wire", &deposit.h_wire),
     373             :     GNUNET_JSON_spec_fixed_auto ("coin_sig",  &deposit.csig),
     374             :     GNUNET_JSON_spec_absolute_time ("timestamp", &deposit.timestamp),
     375             :     GNUNET_JSON_spec_absolute_time ("refund_deadline", &deposit.refund_deadline),
     376             :     GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", &deposit.wire_deadline),
     377             :     GNUNET_JSON_spec_end ()
     378             :   };
     379             : 
     380          36 :   res = TEH_PARSE_post_json (connection,
     381             :                              connection_cls,
     382             :                              upload_data,
     383             :                              upload_data_size,
     384             :                              &json);
     385          36 :   if (GNUNET_SYSERR == res)
     386           0 :     return MHD_NO;
     387          36 :   if ( (GNUNET_NO == res) || (NULL == json) )
     388          24 :     return MHD_YES;
     389          12 :   memset (&deposit, 0, sizeof (deposit));
     390          12 :   res = TEH_PARSE_json_data (connection,
     391             :                              json,
     392             :                              spec);
     393          12 :   json_decref (json);
     394          12 :   if (GNUNET_SYSERR == res)
     395           0 :     return MHD_NO; /* hard failure */
     396          12 :   if (GNUNET_NO == res)
     397           0 :     return MHD_YES; /* failure */
     398             : 
     399          12 :   deposit.receiver_wire_account = wire;
     400          12 :   if (deposit.refund_deadline.abs_value_us > deposit.wire_deadline.abs_value_us)
     401             :   {
     402           0 :     GNUNET_break_op (0);
     403           0 :     GNUNET_JSON_parse_free (spec);
     404           0 :     return TEH_RESPONSE_reply_arg_invalid (connection,
     405             :                                            TALER_EC_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE,
     406             :                                            "refund_deadline");
     407             :   }
     408             : 
     409          12 :   if (TALER_EC_NONE !=
     410          12 :       (ec = TEH_json_validate_wireformat (wire,
     411             :                                           GNUNET_NO,
     412             :                                           &emsg)))
     413             :   {
     414           0 :     GNUNET_JSON_parse_free (spec);
     415           0 :     res = TEH_RESPONSE_reply_external_error (connection,
     416             :                                              ec,
     417             :                                              emsg);
     418           0 :     GNUNET_free (emsg);
     419           0 :     return res;
     420             :   }
     421          12 :   if (GNUNET_OK !=
     422          12 :       check_timestamp_current (deposit.timestamp))
     423             :   {
     424           0 :     GNUNET_break_op (0);
     425           0 :     GNUNET_JSON_parse_free (spec);
     426           0 :     return TEH_RESPONSE_reply_arg_invalid (connection,
     427             :                                            TALER_EC_DEPOSIT_INVALID_TIMESTAMP,
     428             :                                            "timestamp");
     429             :   }
     430          12 :   if (GNUNET_OK !=
     431          12 :       TALER_JSON_hash (wire,
     432             :                        &my_h_wire))
     433             :   {
     434           0 :     TALER_LOG_WARNING ("Failed to parse JSON wire format specification for /deposit request\n");
     435           0 :     GNUNET_JSON_parse_free (spec);
     436           0 :     return TEH_RESPONSE_reply_arg_invalid (connection,
     437             :                                            TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_JSON,
     438             :                                            "wire");
     439             :   }
     440          12 :   if (0 != memcmp (&deposit.h_wire,
     441             :                    &my_h_wire,
     442             :                    sizeof (struct GNUNET_HashCode)))
     443             :   {
     444             :     /* Client hashed contract differently than we did, reject */
     445           0 :     GNUNET_JSON_parse_free (spec);
     446           0 :     return TEH_RESPONSE_reply_arg_invalid (connection,
     447             :                                            TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT,
     448             :                                            "H_wire");
     449             :   }
     450             : 
     451             :   /* check denomination exists and is valid */
     452          12 :   key_state = TEH_KS_acquire ();
     453          12 :   dki = TEH_KS_denomination_key_lookup (key_state,
     454             :                                         &deposit.coin.denom_pub,
     455             :                                         TEH_KS_DKU_DEPOSIT);
     456          12 :   if (NULL == dki)
     457             :   {
     458             :     /* FIXME: #3887: if DK was revoked, we might want to give a 403 and not a 404! */
     459           2 :     TEH_KS_release (key_state);
     460           2 :     TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n");
     461           2 :     GNUNET_JSON_parse_free (spec);
     462           2 :     return TEH_RESPONSE_reply_arg_unknown (connection,
     463             :                                            TALER_EC_DEPOSIT_DENOMINATION_KEY_UNKNOWN,
     464             :                                            "denom_pub");
     465             :   }
     466          10 :   TALER_amount_ntoh (&deposit.deposit_fee,
     467          10 :                      &dki->issue.properties.fee_deposit);
     468             :   /* check coin signature */
     469          10 :   if (GNUNET_YES !=
     470          10 :       TALER_test_coin_valid (&deposit.coin))
     471             :   {
     472           0 :     TALER_LOG_WARNING ("Invalid coin passed for /deposit\n");
     473           0 :     TEH_KS_release (key_state);
     474           0 :     GNUNET_JSON_parse_free (spec);
     475           0 :     return TEH_RESPONSE_reply_signature_invalid (connection,
     476             :                                                  TALER_EC_DEPOSIT_DENOMINATION_SIGNATURE_INVALID,
     477             :                                                  "ub_sig");
     478             :   }
     479          10 :   TALER_amount_ntoh (&deposit.deposit_fee,
     480          10 :                      &dki->issue.properties.fee_deposit);
     481          10 :   TEH_KS_release (key_state);
     482             : 
     483          10 :   if (0 < TALER_amount_cmp (&deposit.deposit_fee,
     484             :                             &deposit.amount_with_fee))
     485             :   {
     486           0 :     GNUNET_break_op (0);
     487           0 :     GNUNET_JSON_parse_free (spec);
     488           0 :     return TEH_RESPONSE_reply_external_error (connection,
     489             :                                               TALER_EC_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE,
     490             :                                               "deposited amount smaller than depositing fee");
     491             :   }
     492             : 
     493          10 :   res = verify_and_execute_deposit (connection,
     494             :                                     &deposit);
     495          10 :   GNUNET_JSON_parse_free (spec);
     496          10 :   return res;
     497             : }
     498             : 
     499             : 
     500             : /* end of taler-exchange-httpd_deposit.c */

Generated by: LCOV version 1.13