use row_id instead of serial_id everywhere

This commit is contained in:
Florian Dold 2017-12-08 17:04:11 +01:00
parent 4872b61781
commit e75afb3164
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
4 changed files with 34 additions and 34 deletions

View File

@ -89,7 +89,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh,
struct TALER_BANK_TransferDetails td; struct TALER_BANK_TransferDetails td;
const char *sign; const char *sign;
uint64_t other_account; uint64_t other_account;
uint64_t serial_id; uint64_t row_id;
enum TALER_BANK_Direction direction; enum TALER_BANK_Direction direction;
struct GNUNET_JSON_Specification hist_spec[] = { struct GNUNET_JSON_Specification hist_spec[] = {
GNUNET_JSON_spec_string ("sign", GNUNET_JSON_spec_string ("sign",
@ -99,7 +99,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh,
GNUNET_JSON_spec_absolute_time ("date", GNUNET_JSON_spec_absolute_time ("date",
&td.execution_date), &td.execution_date),
GNUNET_JSON_spec_uint64 ("row_id", GNUNET_JSON_spec_uint64 ("row_id",
&serial_id), &row_id),
GNUNET_JSON_spec_string ("wt_subject", GNUNET_JSON_spec_string ("wt_subject",
(const char **) &td.wire_transfer_subject), (const char **) &td.wire_transfer_subject),
GNUNET_JSON_spec_uint64 ("counterpart", GNUNET_JSON_spec_uint64 ("counterpart",
@ -144,7 +144,7 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh,
MHD_HTTP_OK, MHD_HTTP_OK,
TALER_EC_NONE, TALER_EC_NONE,
direction, direction,
serial_id, row_id,
&td, &td,
transaction); transaction);
json_decref (td.account_details); json_decref (td.account_details);

View File

@ -80,7 +80,7 @@ struct Transaction
/** /**
* Number of this transaction. * Number of this transaction.
*/ */
uint64_t serial_id; uint64_t row_id;
/** /**
* Flag set if the transfer was rejected. * 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 amount amount to transfer
* @param subject wire transfer subject to use * @param subject wire transfer subject to use
* @param exchange_base_url exchange URL * @param exchange_base_url exchange URL
* @return serial_id of the transfer * @return row_id of the transfer
*/ */
uint64_t uint64_t
TALER_FAKEBANK_make_transfer (struct TALER_FAKEBANK_Handle *h, 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->credit_account = credit_account;
t->amount = *amount; t->amount = *amount;
t->exchange_base_url = GNUNET_strdup (exchange_base_url); 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->date = GNUNET_TIME_absolute_get ();
t->subject = GNUNET_strdup (subject); t->subject = GNUNET_strdup (subject);
GNUNET_TIME_round_abs (&t->date); GNUNET_TIME_round_abs (&t->date);
GNUNET_CONTAINER_DLL_insert_tail (h->transactions_head, GNUNET_CONTAINER_DLL_insert_tail (h->transactions_head,
h->transactions_tail, h->transactions_tail,
t); 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) uint64_t credit_account)
{ {
for (struct Transaction *t = h->transactions_head; NULL != t; t = t->next) 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->credit_account == credit_account) )
{ {
t->rejected = GNUNET_YES; t->rejected = GNUNET_YES;
@ -421,7 +421,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
json_t *json; json_t *json;
struct MHD_Response *resp; struct MHD_Response *resp;
int ret; int ret;
uint64_t serial_id; uint64_t row_id;
pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX, pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
con_cls, con_cls,
@ -467,7 +467,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
json_decref (json); json_decref (json);
return MHD_NO; return MHD_NO;
} }
serial_id = TALER_FAKEBANK_make_transfer (h, row_id = TALER_FAKEBANK_make_transfer (h,
debit_account, debit_account,
credit_account, credit_account,
&amount, &amount,
@ -487,8 +487,8 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
size_t json_len; size_t json_len;
json = json_pack ("{s:I}", json = json_pack ("{s:I}",
"serial_id", "row_id",
(json_int_t) serial_id); (json_int_t) row_id);
json_str = json_dumps (json, json_str = json_dumps (json,
JSON_INDENT(2)); JSON_INDENT(2));
json_decref (json); json_decref (json);
@ -564,10 +564,10 @@ handle_reject (struct TALER_FAKEBANK_Handle *h,
break; break;
} }
{ {
uint64_t serial_id; uint64_t row_id;
uint64_t credit_account; uint64_t credit_account;
struct GNUNET_JSON_Specification spec[] = { 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_uint64 ("credit_account", &credit_account),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
@ -581,11 +581,11 @@ handle_reject (struct TALER_FAKEBANK_Handle *h,
return MHD_NO; return MHD_NO;
} }
found = TALER_FAKEBANK_reject_transfer (h, found = TALER_FAKEBANK_reject_transfer (h,
serial_id, row_id,
credit_account); credit_account);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Rejected wire transfer #%llu (to %llu)\n", "Rejected wire transfer #%llu (to %llu)\n",
(unsigned long long) serial_id, (unsigned long long) row_id,
(unsigned long long) credit_account); (unsigned long long) credit_account);
} }
json_decref (json); json_decref (json);
@ -744,7 +744,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
for (pos = h->transactions_head; for (pos = h->transactions_head;
NULL != pos; NULL != pos;
pos = pos->next) pos = pos->next)
if (pos->serial_id == start_number) if (pos->row_id == start_number)
break; break;
if (NULL == pos) if (NULL == pos)
{ {
@ -800,7 +800,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
? (pos->rejected ? "cancel-" : "-") ? (pos->rejected ? "cancel-" : "-")
: (pos->rejected ? "cancel+" : "+"); : (pos->rejected ? "cancel+" : "+");
trans = json_pack ("{s:I, s:o, s:o, s:s, s:I, s:s}", 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), "date", GNUNET_JSON_from_time_abs (pos->date),
"amount", TALER_JSON_from_amount (&pos->amount), "amount", TALER_JSON_from_amount (&pos->amount),
"sign", sign, "sign", sign,

View File

@ -202,7 +202,7 @@ struct History
/** /**
* Serial ID of the wire transfer. * Serial ID of the wire transfer.
*/ */
uint64_t serial_id; uint64_t row_id;
/** /**
* Direction of the transfer. * Direction of the transfer.
@ -275,8 +275,8 @@ build_history (struct InterpreterState *is,
if (TBI_OC_ADMIN_ADD_INCOMING != pos->oc) if (TBI_OC_ADMIN_ADD_INCOMING != pos->oc)
continue; continue;
if ( (NULL != ref) && if ( (NULL != ref) &&
(ref->details.admin_add_incoming.serial_id == (ref->details.admin_add_incoming.row_id ==
pos->details.admin_add_incoming.serial_id) ) pos->details.admin_add_incoming.row_id) )
{ {
total = 0; total = 0;
ok = GNUNET_YES; ok = GNUNET_YES;
@ -324,8 +324,8 @@ build_history (struct InterpreterState *is,
if (TBI_OC_ADMIN_ADD_INCOMING != pos->oc) if (TBI_OC_ADMIN_ADD_INCOMING != pos->oc)
continue; continue;
if ( (NULL != ref) && if ( (NULL != ref) &&
(ref->details.admin_add_incoming.serial_id == (ref->details.admin_add_incoming.row_id ==
pos->details.admin_add_incoming.serial_id) ) pos->details.admin_add_incoming.row_id) )
{ {
total = 0; total = 0;
ok = GNUNET_YES; ok = GNUNET_YES;
@ -402,8 +402,8 @@ build_history (struct InterpreterState *is,
TALER_string_to_amount (pos->details.admin_add_incoming.amount, TALER_string_to_amount (pos->details.admin_add_incoming.amount,
&h[total].details.amount)); &h[total].details.amount));
/* h[total].execution_date; // unknown here */ /* h[total].execution_date; // unknown here */
h[total].serial_id h[total].row_id
= pos->details.admin_add_incoming.serial_id; = pos->details.admin_add_incoming.row_id;
GNUNET_asprintf (&h[total].details.wire_transfer_subject, GNUNET_asprintf (&h[total].details.wire_transfer_subject,
"%s %s", "%s %s",
pos->details.admin_add_incoming.subject, pos->details.admin_add_incoming.subject,
@ -445,7 +445,7 @@ print_expected (struct History *h,
(unsigned long long) i, (unsigned long long) i,
(TALER_BANK_DIRECTION_CREDIT == h[i].direction) ? "+" : "-", (TALER_BANK_DIRECTION_CREDIT == h[i].direction) ? "+" : "-",
TALER_amount2s (&h[i].details.amount), 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, h[i].details.wire_transfer_subject,
acc); acc);
if (NULL != 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 * @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) * 0 if the bank's reply is bogus (fails to follow the protocol)
* @param ec taler status code * @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 * @param json detailed response from the HTTPD, or NULL if reply was not in JSON
*/ */
static void static void
add_incoming_cb (void *cls, add_incoming_cb (void *cls,
unsigned int http_status, unsigned int http_status,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
uint64_t serial_id, uint64_t row_id,
const json_t *json) const json_t *json)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct TBI_Command *cmd = &is->commands[is->ip]; struct TBI_Command *cmd = &is->commands[is->ip];
cmd->details.admin_add_incoming.aih = NULL; 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) if (cmd->details.admin_add_incoming.expected_response_code != http_status)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -628,7 +628,7 @@ add_incoming_cb (void *cls,
* already returned). * already returned).
* @param ec taler status code * @param ec taler status code
* @param dir direction of the transfer * @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 details details about the wire transfer
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON * @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, unsigned int http_status,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
enum TALER_BANK_Direction dir, enum TALER_BANK_Direction dir,
uint64_t serial_id, uint64_t row_id,
const struct TALER_BANK_TransferDetails *details, const struct TALER_BANK_TransferDetails *details,
const json_t *json) const json_t *json)
{ {
@ -811,7 +811,7 @@ interpreter_run (void *cls)
ref = NULL; ref = NULL;
} }
if (NULL != ref) if (NULL != ref)
rowid = ref->details.admin_add_incoming.serial_id; rowid = ref->details.admin_add_incoming.row_id;
else else
rowid = UINT64_MAX; rowid = UINT64_MAX;
cmd->details.history.hh cmd->details.history.hh
@ -884,7 +884,7 @@ interpreter_run (void *cls)
"http://localhost:8080", "http://localhost:8080",
&auth, &auth,
ref->details.admin_add_incoming.credit_account_no, ref->details.admin_add_incoming.credit_account_no,
ref->details.admin_add_incoming.serial_id, ref->details.admin_add_incoming.row_id,
&reject_cb, &reject_cb,
is); is);
if (NULL == cmd->details.reject.rh) if (NULL == cmd->details.reject.rh)

View File

@ -132,7 +132,7 @@ struct TBI_Command
/** /**
* The serial ID for this record, as returned by the bank. * The serial ID for this record, as returned by the bank.
*/ */
uint64_t serial_id; uint64_t row_id;
} admin_add_incoming; } admin_add_incoming;