From e75afb316484e7a55f913f6584d2a528918223f4 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 8 Dec 2017 17:04:11 +0100 Subject: use row_id instead of serial_id everywhere --- src/bank-lib/bank_api_history.c | 6 +++--- src/bank-lib/fakebank.c | 30 +++++++++++++++--------------- src/bank-lib/test_bank_interpreter.c | 30 +++++++++++++++--------------- src/bank-lib/test_bank_interpreter.h | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/bank-lib/bank_api_history.c b/src/bank-lib/bank_api_history.c index a6c7dceac..3b8a83e13 100644 --- a/src/bank-lib/bank_api_history.c +++ b/src/bank-lib/bank_api_history.c @@ -89,7 +89,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh, struct TALER_BANK_TransferDetails td; const char *sign; uint64_t other_account; - uint64_t serial_id; + uint64_t row_id; enum TALER_BANK_Direction direction; struct GNUNET_JSON_Specification hist_spec[] = { GNUNET_JSON_spec_string ("sign", @@ -99,7 +99,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh, GNUNET_JSON_spec_absolute_time ("date", &td.execution_date), GNUNET_JSON_spec_uint64 ("row_id", - &serial_id), + &row_id), GNUNET_JSON_spec_string ("wt_subject", (const char **) &td.wire_transfer_subject), GNUNET_JSON_spec_uint64 ("counterpart", @@ -144,7 +144,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh, MHD_HTTP_OK, TALER_EC_NONE, direction, - serial_id, + row_id, &td, transaction); json_decref (td.account_details); diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 67175721a..39ba6d7a6 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -80,7 +80,7 @@ struct Transaction /** * Number of this transaction. */ - uint64_t serial_id; + uint64_t row_id; /** * Flag set if the transfer was rejected. @@ -190,7 +190,7 @@ TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h, * @param amount amount to transfer * @param subject wire transfer subject to use * @param exchange_base_url exchange URL - * @return serial_id of the transfer + * @return row_id of the transfer */ uint64_t TALER_FAKEBANK_make_transfer (struct TALER_FAKEBANK_Handle *h, @@ -213,14 +213,14 @@ TALER_FAKEBANK_make_transfer (struct TALER_FAKEBANK_Handle *h, t->credit_account = credit_account; t->amount = *amount; t->exchange_base_url = GNUNET_strdup (exchange_base_url); - t->serial_id = ++h->serial_counter; + t->row_id = ++h->serial_counter; t->date = GNUNET_TIME_absolute_get (); t->subject = GNUNET_strdup (subject); GNUNET_TIME_round_abs (&t->date); GNUNET_CONTAINER_DLL_insert_tail (h->transactions_head, h->transactions_tail, t); - return t->serial_id; + return t->row_id; } @@ -239,7 +239,7 @@ TALER_FAKEBANK_reject_transfer (struct TALER_FAKEBANK_Handle *h, uint64_t credit_account) { for (struct Transaction *t = h->transactions_head; NULL != t; t = t->next) - if ( (t->serial_id == rowid) && + if ( (t->row_id == rowid) && (t->credit_account == credit_account) ) { t->rejected = GNUNET_YES; @@ -421,7 +421,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, json_t *json; struct MHD_Response *resp; int ret; - uint64_t serial_id; + uint64_t row_id; pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX, con_cls, @@ -467,7 +467,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, json_decref (json); return MHD_NO; } - serial_id = TALER_FAKEBANK_make_transfer (h, + row_id = TALER_FAKEBANK_make_transfer (h, debit_account, credit_account, &amount, @@ -487,8 +487,8 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, size_t json_len; json = json_pack ("{s:I}", - "serial_id", - (json_int_t) serial_id); + "row_id", + (json_int_t) row_id); json_str = json_dumps (json, JSON_INDENT(2)); json_decref (json); @@ -564,10 +564,10 @@ handle_reject (struct TALER_FAKEBANK_Handle *h, break; } { - uint64_t serial_id; + uint64_t row_id; uint64_t credit_account; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_uint64 ("row_id", &serial_id), + GNUNET_JSON_spec_uint64 ("row_id", &row_id), GNUNET_JSON_spec_uint64 ("credit_account", &credit_account), GNUNET_JSON_spec_end () }; @@ -581,11 +581,11 @@ handle_reject (struct TALER_FAKEBANK_Handle *h, return MHD_NO; } found = TALER_FAKEBANK_reject_transfer (h, - serial_id, + row_id, credit_account); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Rejected wire transfer #%llu (to %llu)\n", - (unsigned long long) serial_id, + (unsigned long long) row_id, (unsigned long long) credit_account); } json_decref (json); @@ -744,7 +744,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h, for (pos = h->transactions_head; NULL != pos; pos = pos->next) - if (pos->serial_id == start_number) + if (pos->row_id == start_number) break; if (NULL == pos) { @@ -800,7 +800,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h, ? (pos->rejected ? "cancel-" : "-") : (pos->rejected ? "cancel+" : "+"); trans = json_pack ("{s:I, s:o, s:o, s:s, s:I, s:s}", - "row_id", (json_int_t) pos->serial_id, + "row_id", (json_int_t) pos->row_id, "date", GNUNET_JSON_from_time_abs (pos->date), "amount", TALER_JSON_from_amount (&pos->amount), "sign", sign, diff --git a/src/bank-lib/test_bank_interpreter.c b/src/bank-lib/test_bank_interpreter.c index fac0ab692..8f7abf057 100644 --- a/src/bank-lib/test_bank_interpreter.c +++ b/src/bank-lib/test_bank_interpreter.c @@ -202,7 +202,7 @@ struct History /** * Serial ID of the wire transfer. */ - uint64_t serial_id; + uint64_t row_id; /** * Direction of the transfer. @@ -275,8 +275,8 @@ build_history (struct InterpreterState *is, if (TBI_OC_ADMIN_ADD_INCOMING != pos->oc) continue; if ( (NULL != ref) && - (ref->details.admin_add_incoming.serial_id == - pos->details.admin_add_incoming.serial_id) ) + (ref->details.admin_add_incoming.row_id == + pos->details.admin_add_incoming.row_id) ) { total = 0; ok = GNUNET_YES; @@ -324,8 +324,8 @@ build_history (struct InterpreterState *is, if (TBI_OC_ADMIN_ADD_INCOMING != pos->oc) continue; if ( (NULL != ref) && - (ref->details.admin_add_incoming.serial_id == - pos->details.admin_add_incoming.serial_id) ) + (ref->details.admin_add_incoming.row_id == + pos->details.admin_add_incoming.row_id) ) { total = 0; ok = GNUNET_YES; @@ -402,8 +402,8 @@ build_history (struct InterpreterState *is, TALER_string_to_amount (pos->details.admin_add_incoming.amount, &h[total].details.amount)); /* h[total].execution_date; // unknown here */ - h[total].serial_id - = pos->details.admin_add_incoming.serial_id; + h[total].row_id + = pos->details.admin_add_incoming.row_id; GNUNET_asprintf (&h[total].details.wire_transfer_subject, "%s %s", pos->details.admin_add_incoming.subject, @@ -445,7 +445,7 @@ print_expected (struct History *h, (unsigned long long) i, (TALER_BANK_DIRECTION_CREDIT == h[i].direction) ? "+" : "-", TALER_amount2s (&h[i].details.amount), - (unsigned long long) h[i].serial_id, + (unsigned long long) h[i].row_id, h[i].details.wire_transfer_subject, acc); if (NULL != acc) @@ -583,21 +583,21 @@ next (struct InterpreterState *is) * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request * 0 if the bank's reply is bogus (fails to follow the protocol) * @param ec taler status code - * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error + * @param row_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error * @param json detailed response from the HTTPD, or NULL if reply was not in JSON */ static void add_incoming_cb (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, - uint64_t serial_id, + uint64_t row_id, const json_t *json) { struct InterpreterState *is = cls; struct TBI_Command *cmd = &is->commands[is->ip]; cmd->details.admin_add_incoming.aih = NULL; - cmd->details.admin_add_incoming.serial_id = serial_id; + cmd->details.admin_add_incoming.row_id = row_id; if (cmd->details.admin_add_incoming.expected_response_code != http_status) { GNUNET_break (0); @@ -628,7 +628,7 @@ add_incoming_cb (void *cls, * already returned). * @param ec taler status code * @param dir direction of the transfer - * @param serial_id monotonically increasing counter corresponding to the transaction + * @param row_id monotonically increasing counter corresponding to the transaction * @param details details about the wire transfer * @param json detailed response from the HTTPD, or NULL if reply was not in JSON */ @@ -637,7 +637,7 @@ history_cb (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, enum TALER_BANK_Direction dir, - uint64_t serial_id, + uint64_t row_id, const struct TALER_BANK_TransferDetails *details, const json_t *json) { @@ -811,7 +811,7 @@ interpreter_run (void *cls) ref = NULL; } if (NULL != ref) - rowid = ref->details.admin_add_incoming.serial_id; + rowid = ref->details.admin_add_incoming.row_id; else rowid = UINT64_MAX; cmd->details.history.hh @@ -884,7 +884,7 @@ interpreter_run (void *cls) "http://localhost:8080", &auth, ref->details.admin_add_incoming.credit_account_no, - ref->details.admin_add_incoming.serial_id, + ref->details.admin_add_incoming.row_id, &reject_cb, is); if (NULL == cmd->details.reject.rh) diff --git a/src/bank-lib/test_bank_interpreter.h b/src/bank-lib/test_bank_interpreter.h index ed2a00df7..010538ac9 100644 --- a/src/bank-lib/test_bank_interpreter.h +++ b/src/bank-lib/test_bank_interpreter.h @@ -132,7 +132,7 @@ struct TBI_Command /** * The serial ID for this record, as returned by the bank. */ - uint64_t serial_id; + uint64_t row_id; } admin_add_incoming; -- cgit v1.2.3