indenting and minor improvements to refresh operations to make them match API spec
This commit is contained in:
parent
d04360879e
commit
8ecb693990
@ -514,11 +514,8 @@ refresh_accept_melts (struct MHD_Connection *connection,
|
||||
|
||||
if (NULL == dki)
|
||||
return (MHD_YES ==
|
||||
TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_NOT_FOUND,
|
||||
"{s:s}",
|
||||
"error",
|
||||
"denom not found"))
|
||||
TMH_RESPONSE_reply_arg_unknown (connection,
|
||||
"denom_pub"))
|
||||
? GNUNET_NO : GNUNET_SYSERR;
|
||||
|
||||
TALER_amount_ntoh (&coin_value,
|
||||
@ -1253,11 +1250,8 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
|
||||
}
|
||||
if (GNUNET_NO == res)
|
||||
{
|
||||
return TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_NOT_FOUND,
|
||||
"{s:s}",
|
||||
"error",
|
||||
"link data not found (transfer)");
|
||||
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||
"coin_pub");
|
||||
}
|
||||
GNUNET_assert (GNUNET_OK == res);
|
||||
|
||||
|
@ -198,10 +198,8 @@ get_coin_public_info (struct MHD_Connection *connection,
|
||||
r_melt_detail->coin_info.denom_sig.rsa_signature = NULL;
|
||||
r_melt_detail->coin_info.denom_pub.rsa_public_key = NULL;
|
||||
return (MHD_YES ==
|
||||
TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_NOT_FOUND,
|
||||
"{s:s}",
|
||||
"error", "coin invalid"))
|
||||
TMH_RESPONSE_reply_signature_invalid (connection,
|
||||
"denom_sig"))
|
||||
? GNUNET_NO : GNUNET_SYSERR;
|
||||
}
|
||||
r_melt_detail->melt_sig = melt_sig;
|
||||
@ -242,7 +240,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
|
||||
{
|
||||
TMH_KS_release (key_state);
|
||||
TALER_LOG_WARNING ("Unknown denomination key in /refresh/melt request\n");
|
||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
||||
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||
"denom_pub");
|
||||
}
|
||||
/* FIXME: need to check if denomination key is still
|
||||
@ -275,10 +273,8 @@ verify_coin_public_info (struct MHD_Connection *connection,
|
||||
&melt_detail->coin_info.coin_pub.ecdsa_pub))
|
||||
{
|
||||
if (MHD_YES !=
|
||||
TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_UNAUTHORIZED,
|
||||
"{s:s}",
|
||||
"error", "signature invalid"))
|
||||
TMH_RESPONSE_reply_signature_invalid (connection,
|
||||
"confirm_sig"))
|
||||
return GNUNET_SYSERR;
|
||||
return GNUNET_NO;
|
||||
}
|
||||
@ -558,7 +554,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
|
||||
TMH_PARSE_JNC_INDEX, (int) j,
|
||||
TMH_PARSE_JNC_RET_DATA,
|
||||
&rcl->shared_secret_enc,
|
||||
sizeof (struct GNUNET_HashCode));
|
||||
sizeof (struct TALER_EncryptedLinkSecretP));
|
||||
|
||||
if (GNUNET_OK != res)
|
||||
{
|
||||
|
@ -442,7 +442,7 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection
|
||||
|
||||
history = compile_transaction_history (tl);
|
||||
return TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
MHD_HTTP_PRECONDITION_FAILED,
|
||||
"{s:s, s:o}",
|
||||
"error", "insufficient funds",
|
||||
"history", history);
|
||||
@ -625,7 +625,7 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn
|
||||
"balance calculation failure");
|
||||
json_balance = TALER_json_from_amount (&balance);
|
||||
ret = TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_PAYMENT_REQUIRED,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
"{s:s, s:o, s:o}",
|
||||
"error", "Insufficient funds"
|
||||
"balance", json_balance,
|
||||
@ -794,7 +794,7 @@ TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
|
||||
const char *missmatch_object)
|
||||
{
|
||||
return TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_BAD_REQUEST,
|
||||
MHD_HTTP_CONFLICT,
|
||||
"{s:s, s:i, s:i, s:s}",
|
||||
"error", "commitment violation",
|
||||
"offset", (int) off,
|
||||
@ -829,7 +829,8 @@ TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection,
|
||||
json_t *obj;
|
||||
|
||||
obj = json_object ();
|
||||
json_object_set_new (obj, "link_enc",
|
||||
json_object_set_new (obj,
|
||||
"link_enc",
|
||||
TALER_json_from_data (ldl->link_data_enc->coin_priv_enc,
|
||||
sizeof (union TALER_CoinSpendPrivateKeyP) +
|
||||
ldl->link_data_enc->blinding_key_enc_size));
|
||||
|
Loading…
Reference in New Issue
Block a user