diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-19 01:55:37 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-19 01:55:37 +0100 |
commit | 9b4d0634e15fd026a887b4e425abc2a75ddeff04 (patch) | |
tree | 6b10c3dc06b3e3bf2d1bf87678a2ccd2adbba49d /src/exchangedb | |
parent | c75ac3b61295e380f8ea59a75d26426fefe2e4f9 (diff) | |
download | exchange-9b4d0634e15fd026a887b4e425abc2a75ddeff04.tar.xz |
simplify analysis by returning denom_pub with rest of coin transaction data instead of bothering fetching with coin history
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 22 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index f57ac5a29..536a55881 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -799,7 +799,7 @@ postgres_prepare (PGconn *db_conn) ",denom.fee_refresh_curr " ",num_newcoins" ",noreveal_index" - " FROM refresh_sessions " + " FROM refresh_sessions" " JOIN known_coins ON (refresh_sessions.old_coin_pub = known_coins.coin_pub)" " JOIN denominations denom USING (denom_pub)" " WHERE session_hash=$1 ", @@ -809,7 +809,8 @@ postgres_prepare (PGconn *db_conn) refresh session with id '\geq' the given parameter */ PREPARE ("audit_get_refresh_sessions_incr", "SELECT" - " old_coin_pub" + " known_coins.denom_pub" + ",old_coin_pub" ",old_coin_sig" ",amount_with_fee_val" ",amount_with_fee_frac" @@ -819,6 +820,7 @@ postgres_prepare (PGconn *db_conn) ",melt_serial_id" ",session_hash" " FROM refresh_sessions" + " JOIN known_coins ON (refresh_sessions.old_coin_pub = known_coins.coin_pub)" " WHERE melt_serial_id>=$1" " ORDER BY melt_serial_id ASC", 1, NULL); @@ -905,12 +907,14 @@ postgres_prepare (PGconn *db_conn) ",merchant_sig" ",h_proposal_data" ",rtransaction_id" + ",known_coins.denom_pub" ",coin_pub" ",amount_with_fee_val" ",amount_with_fee_frac" ",amount_with_fee_curr" ",refund_serial_id" " FROM refunds" + " JOIN known_coins ON (coin_pub)" " WHERE refund_serial_id>=$1" " ORDER BY refund_serial_id ASC", 1, NULL); @@ -1040,6 +1044,7 @@ postgres_prepare (PGconn *db_conn) ",amount_with_fee_curr" ",timestamp" ",merchant_pub" + ",known_coins.denom_pub" ",coin_pub" ",coin_sig" ",refund_deadline" @@ -1049,6 +1054,7 @@ postgres_prepare (PGconn *db_conn) ",done" ",deposit_serial_id" " FROM deposits" + " JOIN known_coins ON (coin_pub)" " WHERE (" " (deposit_serial_id>=$1)" " )" @@ -4853,6 +4859,7 @@ postgres_select_deposits_above_serial_id (void *cls, for (i=0;i<nrows;i++) { struct TALER_EXCHANGEDB_Deposit deposit; + struct TALER_DenominationPublicKey denom_pub; uint8_t done = 0; uint64_t rowid; struct GNUNET_PQ_ResultSpec rs[] = { @@ -4862,6 +4869,8 @@ postgres_select_deposits_above_serial_id (void *cls, &deposit.timestamp), GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", &deposit.merchant_pub), + GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", + &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &deposit.coin.coin_pub), GNUNET_PQ_result_spec_auto_from_type ("coin_sig", @@ -4893,6 +4902,7 @@ postgres_select_deposits_above_serial_id (void *cls, rowid, deposit.timestamp, &deposit.merchant_pub, + &denom_pub, &deposit.coin.coin_pub, &deposit.csig, &deposit.amount_with_fee, @@ -4957,6 +4967,7 @@ postgres_select_refreshs_above_serial_id (void *cls, for (i=0;i<nrows;i++) { + struct TALER_DenominationPublicKey denom_pub; struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendSignatureP coin_sig; struct TALER_Amount amount_with_fee; @@ -4966,6 +4977,8 @@ postgres_select_refreshs_above_serial_id (void *cls, struct GNUNET_HashCode session_hash; struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", + &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub", &coin_pub), GNUNET_PQ_result_spec_auto_from_type ("old_coin_sig", @@ -4993,6 +5006,7 @@ postgres_select_refreshs_above_serial_id (void *cls, } cb (cb_cls, rowid, + &denom_pub, &coin_pub, &coin_sig, &amount_with_fee, @@ -5054,6 +5068,7 @@ postgres_select_refunds_above_serial_id (void *cls, for (i=0;i<nrows;i++) { struct TALER_EXCHANGEDB_Refund refund; + struct TALER_DenominationPublicKey denom_pub; uint64_t rowid; struct GNUNET_PQ_ResultSpec rs[] = { @@ -5065,6 +5080,8 @@ postgres_select_refunds_above_serial_id (void *cls, &refund.h_proposal_data), GNUNET_PQ_result_spec_uint64 ("rtransaction_id", &refund.rtransaction_id), + GNUNET_PQ_result_spec_rsa_public_key ("denom_pub", + &denom_pub.rsa_public_key), GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &refund.coin.coin_pub), TALER_PQ_result_spec_amount ("amount_with_fee", @@ -5084,6 +5101,7 @@ postgres_select_refunds_above_serial_id (void *cls, } cb (cb_cls, rowid, + &denom_pub, &refund.coin.coin_pub, &refund.merchant_pub, &refund.merchant_sig, diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index d645abeae..c7f97998d 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -481,6 +481,7 @@ static unsigned int auditor_row_cnt; * * @param cls closure * @param rowid unique serial ID for the refresh session in our DB + * @param denom_pub denomination of the @a coin_pub * @param coin_pub public key of the coin * @param coin_sig signature from the coin * @param amount_with_fee amount that was deposited including fee @@ -492,6 +493,7 @@ static unsigned int auditor_row_cnt; static int audit_refresh_session_cb (void *cls, uint64_t rowid, + const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_Amount *amount_with_fee, @@ -927,6 +929,7 @@ deposit_cb (void *cls, * @param rowid unique serial ID for the deposit in our DB * @param timestamp when did the deposit happen * @param merchant_pub public key of the merchant + * @param denom_pub denomination of the @a coin_pub * @param coin_pub public key of the coin * @param coin_sig signature from the coin * @param amount_with_fee amount that was deposited including fee @@ -944,6 +947,7 @@ audit_deposit_cb (void *cls, uint64_t rowid, struct GNUNET_TIME_Absolute timestamp, const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_Amount *amount_with_fee, @@ -964,6 +968,7 @@ audit_deposit_cb (void *cls, * * @param cls closure * @param rowid unique serial ID for the refund in our DB + * @param denom_pub denomination of the @a coin_pub * @param coin_pub public key of the coin * @param merchant_pub public key of the merchant * @param merchant_sig signature of the merchant @@ -976,6 +981,7 @@ audit_deposit_cb (void *cls, static int audit_refund_cb (void *cls, uint64_t rowid, + const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantSignatureP *merchant_sig, |