remove unused/unusable coin_sig, return correct coin_pub in recoup-reveal failure context

This commit is contained in:
Christian Grothoff 2020-07-10 22:33:04 +02:00
parent d01c6fd902
commit ddf95c491a
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
6 changed files with 78 additions and 32 deletions

View File

@ -250,7 +250,7 @@ TEH_RESPONSE_compile_transaction_history (
TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH),
.purpose.size = htonl (sizeof (pc)),
.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp),
.coin_pub = *coin_pub,
.coin_pub = pr->coin.coin_pub,
.old_coin_pub = pr->old_coin_pub
};
@ -273,7 +273,7 @@ TEH_RESPONSE_compile_transaction_history (
if (0 !=
json_array_append_new (
history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type",
"OLD-COIN-RECOUP",
"amount",
@ -284,8 +284,6 @@ TEH_RESPONSE_compile_transaction_history (
GNUNET_JSON_from_data_auto (&epub),
"coin_pub",
GNUNET_JSON_from_data_auto (&pr->coin.coin_pub),
"coin_sig",
GNUNET_JSON_from_data_auto (&pr->coin_sig),
"timestamp",
GNUNET_JSON_from_time_abs (pr->timestamp))))
{

View File

@ -4553,6 +4553,11 @@ postgres_get_coin_transactions (
params,
work[i].cb,
&chc);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Coin %s yielded %d transactions of type %s\n",
TALER_B2S (coin_pub),
qs,
work[i].statement);
if ( (0 > qs) ||
(chc.failed) )
{
@ -6913,6 +6918,9 @@ postgres_insert_recoup_request (
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Inserting recoup for coin %s\n",
TALER_B2S (&coin->coin_pub));
expiry = GNUNET_TIME_absolute_add (timestamp,
pg->legal_reserve_expiration_time);
reserve.gc = GNUNET_TIME_absolute_max (expiry,
@ -6976,6 +6984,9 @@ postgres_insert_recoup_refresh_request (
(void) cls;
/* now store actual recoup information */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Inserting recoup-refresh for coin %s\n",
TALER_B2S (&coin->coin_pub));
qs = GNUNET_PQ_eval_prepared_non_select (session->conn,
"recoup_refresh_insert",
params);

View File

@ -373,7 +373,7 @@ struct TALER_EXCHANGEDB_RecoupRefreshListEntry
/**
* Blinding factor supplied to prove to the exchange that
* the coin came from this reserve.
* the coin came from this @e old_coin_pub.
*/
struct TALER_DenominationBlindingKeyP coin_blind;

View File

@ -1219,7 +1219,7 @@ struct TALER_RecoupRequestPS
struct TALER_CoinSpendPublicKeyP coin_pub;
/**
* Hash of the denomination public key of the coin.
* Hash of the (revoked) denomination public key of the coin.
*/
struct GNUNET_HashCode h_denom_pub;

View File

@ -876,7 +876,8 @@ TALER_EXCHANGE_verify_coin_history (
TALER_amount_hton (&pc.recoup_amount,
&amount);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP,
GNUNET_CRYPTO_eddsa_verify (
TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH,
&pc,
&exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub))
@ -890,6 +891,9 @@ TALER_EXCHANGE_verify_coin_history (
{
/* signature not supported, new version on server? */
GNUNET_break_op (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected type `%s' in response\n",
type);
GNUNET_assert (GNUNET_SYSERR == add);
return GNUNET_SYSERR;
}

View File

@ -675,28 +675,61 @@ run (void *cls,
"recoup-reveal-coin-1b",
"recoup-melt-coin-1b",
"EUR:5"),
#if 1
/* "over-spend" 10 EUR recoup-refreshed coin */
TALER_TESTING_cmd_deposit ("recoup-refresh-deposit-failing",
/* melt 10 EUR coin *again* to get 1 EUR refreshed coin */
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1a",
"recoup-withdraw-coin-1b",
0,
bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:11.5",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_refresh_reveal ("recoup-reveal-coin-1a",
"recoup-remelt-coin-1a",
MHD_HTTP_OK),
// FIXME: yes, we expect 'CONFLICT', but the
// coin history we get is totally wrong!
/* "spend" 10 EUR recoup-refreshed coin */
TALER_TESTING_cmd_deposit ("recoup-refresh-deposit-ok",
/* Try melting for more than the residual value to provoke an error */
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1b",
"recoup-withdraw-coin-1b",
0,
bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:9.5", /* FIXME: pick 'right' amount! */
MHD_HTTP_OK),
#endif
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1c",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1d",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1e",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1f",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1g",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1h",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1i",
"recoup-withdraw-coin-1b",
MHD_HTTP_OK,
"EUR:1",
NULL),
TALER_TESTING_cmd_melt ("recoup-remelt-coin-1b-failing",
"recoup-withdraw-coin-1b",
MHD_HTTP_CONFLICT,
"EUR:1",
NULL),
/* Re-withdraw from this reserve */
TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2",
"recoup-create-reserve-1",