From bb44b9b4756413eceff0c3b6184ef6d921e65d16 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Wed, 13 Feb 2019 17:53:48 +0100 Subject: [PATCH] Fix #5558. --- src/exchange-tools/taler-wire.c | 3 +- src/exchange/taler-exchange-aggregator.c | 3 +- src/include/taler_wire_plugin.h | 4 +- src/wire-plugins/plugin_wire_taler-bank.c | 8 +++- ...test_wire_plugin_transactions_taler-bank.c | 37 +++++++++++++------ 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/exchange-tools/taler-wire.c b/src/exchange-tools/taler-wire.c index 8e378eeef..79e5de3db 100644 --- a/src/exchange-tools/taler-wire.c +++ b/src/exchange-tools/taler-wire.c @@ -140,7 +140,8 @@ history_cb (void *cls, void confirmation_cb (void *cls, int success, - uint64_t serial_id, + const void *row_id, + size_t row_id_size, const char *emsg) { if (GNUNET_YES != success) diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index 38654aaaa..af0c8e6c0 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -1647,7 +1647,8 @@ prepare_cb (void *cls, static void wire_confirm_cb (void *cls, int success, - uint64_t serial_id, + const void *row_id, + size_t row_id_size, const char *emsg) { struct TALER_EXCHANGEDB_Session *session = wpd->session; diff --git a/src/include/taler_wire_plugin.h b/src/include/taler_wire_plugin.h index 3707d7afc..57122a437 100644 --- a/src/include/taler_wire_plugin.h +++ b/src/include/taler_wire_plugin.h @@ -148,10 +148,10 @@ struct TALER_WIRE_HistoryHandle; typedef void (*TALER_WIRE_ConfirmationCallback)(void *cls, int success, - uint64_t serial_id, + const void *row_id, + size_t row_id_size, const char *emsg); - /** * @brief The plugin API, returned from the plugin's "init" function. * The argument given to "init" is simply a configuration handle. diff --git a/src/wire-plugins/plugin_wire_taler-bank.c b/src/wire-plugins/plugin_wire_taler-bank.c index 12ef82487..0cd79b2d7 100644 --- a/src/wire-plugins/plugin_wire_taler-bank.c +++ b/src/wire-plugins/plugin_wire_taler-bank.c @@ -632,6 +632,7 @@ execute_cb (void *cls, json_t *reason; const char *emsg; char *s; + uint64_t serial_id_nbo; eh->aaih = NULL; emsg = NULL; @@ -653,10 +654,15 @@ execute_cb (void *cls, "%u/%u", http_status, (unsigned int) ec); + + serial_id_nbo = GNUNET_htonll (serial_id); + eh->cc (eh->cc_cls, (MHD_HTTP_OK == http_status) ? GNUNET_OK : GNUNET_SYSERR, - serial_id, + &serial_id_nbo, + sizeof (uint64_t), (MHD_HTTP_OK == http_status) ? NULL : s); + GNUNET_free (s); GNUNET_free (eh); } diff --git a/src/wire-plugins/test_wire_plugin_transactions_taler-bank.c b/src/wire-plugins/test_wire_plugin_transactions_taler-bank.c index 06aef8aa1..da1d43c1a 100644 --- a/src/wire-plugins/test_wire_plugin_transactions_taler-bank.c +++ b/src/wire-plugins/test_wire_plugin_transactions_taler-bank.c @@ -153,18 +153,21 @@ timeout_cb (void *cls) * @param cls closure * @param ec taler status code * @param dir direction of the transfer - * @param row_off identification of the position at which we are querying + * @param row_off identification of the position at + * which we are querying * @param row_off_size number of bytes in @a row_off * @param details details about the wire transfer - * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration + * @return #GNUNET_OK to continue, #GNUNET_SYSERR to + * abort iteration */ static int -history_result_cb (void *cls, - enum TALER_ErrorCode ec, - enum TALER_BANK_Direction dir, - const void *row_off, - size_t row_off_size, - const struct TALER_WIRE_TransferDetails *details) +history_result_cb + (void *cls, + enum TALER_ErrorCode ec, + enum TALER_BANK_Direction dir, + const void *row_off, + size_t row_off_size, + const struct TALER_WIRE_TransferDetails *details) { uint64_t *serialp; uint64_t serialh; @@ -222,16 +225,20 @@ history_result_cb (void *cls, * Function called with the result from the execute step. * * @param cls closure - * @param success #GNUNET_OK on success, #GNUNET_SYSERR on failure - * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error + * @param success #GNUNET_OK on success, + * #GNUNET_SYSERR on failure + * @param row_id ID of the fresh transaction, + * in _network_ byte order. * @param emsg NULL on success, otherwise an error message */ static void confirmation_cb (void *cls, int success, - uint64_t serial_id, + const void *row_id, + size_t row_id_size, const char *emsg) { + uint64_t tmp; eh = NULL; if (GNUNET_OK != success) { @@ -240,7 +247,13 @@ confirmation_cb (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - serial_target = serial_id; + + memcpy (&tmp, + row_id, + row_id_size); + + serial_target = GNUNET_ntohll (tmp); + hh = plugin->get_history (plugin->cls, my_account, TALER_BANK_DIRECTION_BOTH,