diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-12-21 23:57:23 +0100 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-12-21 23:57:23 +0100 |
commit | fa5582930e6198e2783ae9cad59d2d2b4ce2ee1a (patch) | |
tree | 12fc2dd1398e403d63dbabcef33ad7b62de0bf8d /src/exchange/taler-exchange-httpd_responses.c | |
parent | 98ca8478952ab57b3a9f3b8f9efc4a7bb11d2a53 (diff) | |
download | exchange-fa5582930e6198e2783ae9cad59d2d2b4ce2ee1a.tar.gz exchange-fa5582930e6198e2783ae9cad59d2d2b4ce2ee1a.tar.bz2 exchange-fa5582930e6198e2783ae9cad59d2d2b4ce2ee1a.zip |
[wip, #7267] more refined denomination conflict response during deposit
If a coin was known but with a different denomination, return to the
client an error response that contains the denomination's public key and
the corresponding signature of the provided coin.
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 2d8dede51..a6d2c7ffc 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -180,6 +180,29 @@ TEH_RESPONSE_reply_coin_insufficient_funds ( MHD_RESULT +TEH_RESPONSE_reply_coin_denomination_conflict ( + struct MHD_Connection *connection, + enum TALER_ErrorCode ec, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_DenominationPublicKey *prev_denom_pub, + const struct TALER_DenominationSignature *prev_denom_sig) +{ + return TALER_MHD_REPLY_JSON_PACK ( + connection, + TALER_ErrorCode_get_http_status_safe (ec), + TALER_JSON_pack_ec (ec), + GNUNET_JSON_pack_data_auto ("coin_pub", + coin_pub), + TALER_JSON_pack_denom_pub ("prev_denom_pub", + prev_denom_pub), + TALER_JSON_pack_denom_sig ("prev_denom_sig", + prev_denom_sig) + ); + +} + + +MHD_RESULT TEH_RESPONSE_reply_coin_age_commitment_conflict ( struct MHD_Connection *connection, enum TALER_ErrorCode ec, @@ -188,7 +211,6 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict ( const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_AgeCommitmentHash *h_age_commitment) { - const struct TALER_AgeCommitmentHash *hac = h_age_commitment; const char *conflict_detail; switch (status) @@ -196,10 +218,10 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict ( case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NULL: conflict_detail = "expected NULL age commitment hash"; - hac = NULL; + h_age_commitment = NULL; break; case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NON_NULL: - conflict_detail = "unexpected NULL age commitment hash"; + conflict_detail = "expected non-NULL age commitment hash"; break; case TALER_EXCHANGEDB_CKS_AGE_CONFLICT_VALUE_DIFFERS: conflict_detail = "expected age commitment hash differs"; @@ -218,7 +240,7 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict ( h_denom_pub), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_data_auto ("expected_age_commitment_hash", - hac)), + h_age_commitment)), GNUNET_JSON_pack_string ("conflict_detail", conflict_detail) ); |