diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-03-26 20:54:41 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-03-26 20:54:41 +0100 |
commit | f052527ea50e9e6b1de165833e83d7f191a121d1 (patch) | |
tree | 925e9d9f0be26b9975231638d394a22aa32c6505 /src/exchangedb | |
parent | 394765a1e60cab4504817ca364429222e76f59ce (diff) |
fix recoup-refresh audit logic
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 39 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 1 |
2 files changed, 24 insertions, 16 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 31f92d58c..c21f1b1a9 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1192,8 +1192,8 @@ postgres_get_session (void *cls) ",coin_blind" ",h_blind_ev" ",coins.denom_pub_hash" - ",denoms.denom_pub" ",coins.denom_sig" + ",denoms.denom_pub" ",amount_val" ",amount_frac" " FROM recoup" @@ -1213,24 +1213,27 @@ postgres_get_session (void *cls) " recoup_refresh_uuid" ",timestamp" ",rc.old_coin_pub" - ",coin_pub" + ",old_coins.denom_pub_hash AS old_denom_pub_hash" + ",recoup_refresh.coin_pub" ",coin_sig" ",coin_blind" - ",h_blind_ev" - ",coins.denom_pub_hash" ",denoms.denom_pub" - ",coins.denom_sig" + ",h_blind_ev" + ",new_coins.denom_pub_hash" + ",new_coins.denom_sig" ",amount_val" ",amount_frac" " FROM recoup_refresh" - " JOIN refresh_revealed_coins rrc" + " INNER JOIN refresh_revealed_coins rrc" " ON (rrc.h_coin_ev = h_blind_ev)" - " JOIN refresh_commitments rc" + " INNER JOIN refresh_commitments rc" " ON (rrc.rc = rc.rc)" - " JOIN known_coins coins" - " USING (coin_pub)" - " JOIN denominations denoms" - " ON (coins.denom_pub_hash = denoms.denom_pub_hash)" + " INNER JOIN known_coins old_coins" + " ON (rc.old_coin_pub = old_coins.coin_pub)" + " INNER JOIN known_coins new_coins" + " ON (new_coins.coin_pub = recoup_refresh.coin_pub)" + " INNER JOIN denominations denoms" + " ON (new_coins.denom_pub_hash = denoms.denom_pub_hash)" " WHERE recoup_refresh_uuid>=$1" " ORDER BY recoup_refresh_uuid ASC;", 1), @@ -6381,8 +6384,8 @@ recoup_serial_helper_cb (void *cls, struct TALER_CoinPublicInfo coin; struct TALER_CoinSpendSignatureP coin_sig; struct TALER_DenominationBlindingKeyP coin_blind; - struct TALER_DenominationPublicKey denom_pub; struct TALER_Amount amount; + struct TALER_DenominationPublicKey denom_pub; struct GNUNET_HashCode h_blind_ev; struct GNUNET_TIME_Absolute timestamp; struct GNUNET_PQ_ResultSpec rs[] = { @@ -6394,6 +6397,8 @@ recoup_serial_helper_cb (void *cls, &reserve_pub), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &coin.coin_pub), + GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", + &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_auto_from_type ("coin_sig", &coin_sig), GNUNET_PQ_result_spec_auto_from_type ("coin_blind", @@ -6402,8 +6407,6 @@ recoup_serial_helper_cb (void *cls, &h_blind_ev), GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &coin.denom_pub_hash), - GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", - &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_rsa_signature ("denom_sig", &coin.denom_sig.rsa_signature), TALER_PQ_RESULT_SPEC_AMOUNT ("amount", @@ -6532,6 +6535,7 @@ recoup_refresh_serial_helper_cb (void *cls, struct TALER_CoinSpendSignatureP coin_sig; struct TALER_DenominationBlindingKeyP coin_blind; struct TALER_DenominationPublicKey denom_pub; + struct GNUNET_HashCode old_denom_pub_hash; struct TALER_Amount amount; struct GNUNET_HashCode h_blind_ev; struct GNUNET_TIME_Absolute timestamp; @@ -6542,18 +6546,20 @@ recoup_refresh_serial_helper_cb (void *cls, ×tamp), GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub", &old_coin_pub), + GNUNET_PQ_result_spec_auto_from_type ("old_denom_pub_hash", + &old_denom_pub_hash), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &coin.coin_pub), GNUNET_PQ_result_spec_auto_from_type ("coin_sig", &coin_sig), GNUNET_PQ_result_spec_auto_from_type ("coin_blind", &coin_blind), + GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", + &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_auto_from_type ("h_blind_ev", &h_blind_ev), GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", &coin.denom_pub_hash), - GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", - &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_rsa_signature ("denom_sig", &coin.denom_sig.rsa_signature), TALER_PQ_RESULT_SPEC_AMOUNT ("amount", @@ -6576,6 +6582,7 @@ recoup_refresh_serial_helper_cb (void *cls, timestamp, &amount, &old_coin_pub, + &old_denom_pub_hash, &coin, &denom_pub, &coin_sig, diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index e9b47942a..96fbe3dc2 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -1317,6 +1317,7 @@ drop: * @param amount how much should be added back to the reserve * @param reserve_pub public key of the reserve * @param coin public information about the coin + * @param denom_pub denomination key of @a coin * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP * @param coin_blind blinding factor used to blind the coin * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop |