From 922323b4104abfaef2a11fed4e5e8292344a3bcd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Jul 2015 16:55:01 +0200 Subject: misc bugfixes from tests --- src/mint/taler-mint-httpd_deposit.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/mint/taler-mint-httpd_deposit.c') diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c index 19ea9cb50..782d05a8b 100644 --- a/src/mint/taler-mint-httpd_deposit.c +++ b/src/mint/taler-mint-httpd_deposit.c @@ -101,14 +101,12 @@ verify_and_execute_deposit (struct MHD_Connection *connection, } TALER_amount_ntoh (&fee_deposit, &dki->issue.fee_deposit); - if (TALER_amount_cmp (&fee_deposit, - &deposit->amount_with_fee) < 0) + if (0 < TALER_amount_cmp (&fee_deposit, + &deposit->amount_with_fee)) { TMH_KS_release (key_state); - return (MHD_YES == - TMH_RESPONSE_reply_external_error (connection, - "deposited amount smaller than depositing fee")) - ? GNUNET_NO : GNUNET_SYSERR; + return TMH_RESPONSE_reply_external_error (connection, + "deposited amount smaller than depositing fee"); } TMH_KS_release (key_state); @@ -146,7 +144,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection, TMH_PARSE_MEMBER_FIXED ("H_contract", &deposit.h_contract), TMH_PARSE_MEMBER_FIXED ("H_wire", &deposit.h_wire), TMH_PARSE_MEMBER_FIXED ("coin_sig", &deposit.csig), - TMH_PARSE_MEMBER_FIXED ("transaction_id", &deposit.transaction_id), + TMH_PARSE_member_uint64 ("transaction_id", &deposit.transaction_id), TMH_PARSE_member_time_abs ("timestamp", &deposit.timestamp), TMH_PARSE_member_time_abs ("refund_deadline", &deposit.refund_deadline), TMH_PARSE_MEMBER_END @@ -160,6 +158,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection, return MHD_NO; /* hard failure */ if (GNUNET_NO == res) return MHD_YES; /* failure */ + if (GNUNET_YES != TALER_json_validate_wireformat (TMH_expected_wire_format, wire)) @@ -197,7 +196,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection, &deposit.deposit_fee)) { /* Total amount smaller than fee, invalid */ - TMH_PARSE_release_data (spec); + TMH_PARSE_release_data (spec); return TMH_RESPONSE_reply_arg_invalid (connection, "f"); } @@ -247,7 +246,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; if (-1 == json_unpack (json, - "{s:s, s:o, f:o}", + "{s:o, s:o}", "wire", &wire, "f", &f)) { -- cgit v1.2.3