aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-01 16:52:10 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-01 16:52:10 +0200
commit85735a5e6b0058d941cabe305dadd311f218592a (patch)
treedb634b39741097262deed34d7f28e81b3f898582
parentd45774ccecaed85f45c2eebe641e2d2f8c8673af (diff)
downloadexchange-85735a5e6b0058d941cabe305dadd311f218592a.tar.gz
exchange-85735a5e6b0058d941cabe305dadd311f218592a.zip
-have fakebank return correct time
-rw-r--r--src/bank-lib/fakebank.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 1fac5e1b6..7dbbd531c 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -662,6 +662,7 @@ post_transaction (struct TALER_FAKEBANK_Handle *h,
662 * @param exchange_base_url exchange URL 662 * @param exchange_base_url exchange URL
663 * @param request_uid unique number to make the request unique, or NULL to create one 663 * @param request_uid unique number to make the request unique, or NULL to create one
664 * @param[out] ret_row_id pointer to store the row ID of this transaction 664 * @param[out] ret_row_id pointer to store the row ID of this transaction
665 * @param[out] timestamp set to the time of the transfer
665 * @return #GNUNET_YES if the transfer was successful, 666 * @return #GNUNET_YES if the transfer was successful,
666 * #GNUNET_SYSERR if the request_uid was reused for a different transfer 667 * #GNUNET_SYSERR if the request_uid was reused for a different transfer
667 */ 668 */
@@ -674,7 +675,8 @@ make_transfer (
674 const struct TALER_WireTransferIdentifierRawP *subject, 675 const struct TALER_WireTransferIdentifierRawP *subject,
675 const char *exchange_base_url, 676 const char *exchange_base_url,
676 const struct GNUNET_HashCode *request_uid, 677 const struct GNUNET_HashCode *request_uid,
677 uint64_t *ret_row_id) 678 uint64_t *ret_row_id,
679 struct GNUNET_TIME_Absolute *timestamp)
678{ 680{
679 struct Transaction *t; 681 struct Transaction *t;
680 struct Account *debit_acc; 682 struct Account *debit_acc;
@@ -732,6 +734,7 @@ make_transfer (
732 t->amount = *amount; 734 t->amount = *amount;
733 t->date = GNUNET_TIME_absolute_get (); 735 t->date = GNUNET_TIME_absolute_get ();
734 (void) GNUNET_TIME_round_abs (&t->date); 736 (void) GNUNET_TIME_round_abs (&t->date);
737 *timestamp = t->date;
735 t->type = T_DEBIT; 738 t->type = T_DEBIT;
736 memcpy (t->subject.debit.exchange_base_url, 739 memcpy (t->subject.debit.exchange_base_url,
737 exchange_base_url, 740 exchange_base_url,
@@ -1114,6 +1117,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
1114 enum GNUNET_JSON_PostResult pr; 1117 enum GNUNET_JSON_PostResult pr;
1115 json_t *json; 1118 json_t *json;
1116 uint64_t row_id; 1119 uint64_t row_id;
1120 struct GNUNET_TIME_Absolute ts;
1117 1121
1118 pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX, 1122 pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
1119 connection, 1123 connection,
@@ -1180,7 +1184,8 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
1180 &wtid, 1184 &wtid,
1181 base_url, 1185 base_url,
1182 &uuid, 1186 &uuid,
1183 &row_id); 1187 &row_id,
1188 &ts);
1184 if (GNUNET_OK != ret) 1189 if (GNUNET_OK != ret)
1185 { 1190 {
1186 MHD_RESULT res; 1191 MHD_RESULT res;
@@ -1215,9 +1220,8 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
1215 MHD_HTTP_OK, 1220 MHD_HTTP_OK,
1216 GNUNET_JSON_pack_uint64 ("row_id", 1221 GNUNET_JSON_pack_uint64 ("row_id",
1217 row_id), 1222 row_id),
1218 /* dummy timestamp */
1219 GNUNET_JSON_pack_time_abs ("timestamp", 1223 GNUNET_JSON_pack_time_abs ("timestamp",
1220 GNUNET_TIME_UNIT_ZERO_ABS)); 1224 ts));
1221} 1225}
1222 1226
1223 1227