summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-04-03 16:40:31 +0200
committerChristian Grothoff <christian@grothoff.org>2017-04-03 16:40:31 +0200
commit29a2f9b345ecd8a6c062b3b3cfa719a8a4ec2a08 (patch)
tree5b8849767e0eb1941e03a99ef3eaa53fb6e427d7 /src/exchangedb
parent5b867c4b8ece4b4f92ff206fa75a4ea29d870221 (diff)
downloadexchange-29a2f9b345ecd8a6c062b3b3cfa719a8a4ec2a08.tar.gz
exchange-29a2f9b345ecd8a6c062b3b3cfa719a8a4ec2a08.tar.bz2
exchange-29a2f9b345ecd8a6c062b3b3cfa719a8a4ec2a08.zip
implement rest of exchange logic for #3887 (return payback information in reserve and coin histories)
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c11
-rw-r--r--src/exchangedb/test_exchangedb.c5
2 files changed, 7 insertions, 9 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index df0c1a5fc..e869bcd95 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -5629,7 +5629,7 @@ postgres_select_wire_out_above_serial_id (void *cls,
* @param amount total amount to be paid back
* @param receiver_account_details who should receive the funds
* @parma h_blind_ev hash of the blinded coin's envelope (must match reserves_out entry)
- * @param[out] deadline set to absolute time by when the exchange plans to pay it back
+ * @param timestamp current time (rounded)
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on DB errors
*/
@@ -5642,10 +5642,9 @@ postgres_insert_payback_request (void *cls,
const struct TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_Amount *amount,
const struct GNUNET_HashCode *h_blind_ev,
- struct GNUNET_TIME_Absolute *deadline)
+ struct GNUNET_TIME_Absolute timestamp)
{
PGresult *result;
- struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute expiry;
struct TALER_EXCHANGEDB_Reserve reserve;
struct GNUNET_PQ_QueryParam params[] = {
@@ -5654,12 +5653,11 @@ postgres_insert_payback_request (void *cls,
GNUNET_PQ_query_param_auto_from_type (coin_sig),
GNUNET_PQ_query_param_auto_from_type (coin_blind),
TALER_PQ_query_param_amount (amount),
- GNUNET_PQ_query_param_absolute_time (&now),
+ GNUNET_PQ_query_param_absolute_time (&timestamp),
GNUNET_PQ_query_param_auto_from_type (h_blind_ev),
GNUNET_PQ_query_param_end
};
- now = GNUNET_TIME_absolute_get ();
result = GNUNET_PQ_exec_prepared (session->conn,
"payback_insert",
params);
@@ -5689,7 +5687,7 @@ postgres_insert_payback_request (void *cls,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- expiry = GNUNET_TIME_absolute_add (now,
+ expiry = GNUNET_TIME_absolute_add (timestamp,
TALER_IDLE_RESERVE_EXPIRATION_TIME);
reserve.expiry = GNUNET_TIME_absolute_max (expiry,
reserve.expiry);
@@ -5700,7 +5698,6 @@ postgres_insert_payback_request (void *cls,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- *deadline = reserve.expiry;
return GNUNET_OK;
}
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 0fc0f92b4..e8fd21194 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -1511,6 +1511,7 @@ run (void *cls)
RND_BLK (&coin_sig);
RND_BLK (&coin_blind);
+ deadline = GNUNET_TIME_absolute_get ();
FAILIF (GNUNET_OK !=
plugin->insert_payback_request (plugin->cls,
session,
@@ -1520,7 +1521,7 @@ run (void *cls)
&coin_blind,
&value,
&cbc.h_coin_envelope,
- &deadline));
+ deadline));
result = 7;
rh = plugin->get_reserve_history (plugin->cls,
@@ -1719,7 +1720,7 @@ run (void *cls)
&coin_blind,
&value,
&cbc.h_coin_envelope,
- &deadline));
+ deadline));
auditor_row_cnt = 0;
FAILIF (GNUNET_OK !=