-GET purse test passes

This commit is contained in:
Christian Grothoff 2022-04-30 17:35:24 +02:00
parent fed8353c67
commit f99fb9ad4b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 45 additions and 31 deletions

View File

@ -277,20 +277,6 @@ deposit_transaction (void *cls,
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
{
struct TALER_PurseEventP rep = {
.header.size = htons (sizeof (rep)),
.header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_DEPOSITED),
.purse_pub = *pcc->purse_pub
};
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Notifying about purse deposit\n");
TEH_plugin->event_notify (TEH_plugin->cls,
&rep.header,
NULL,
0);
}
return qs;
}
@ -656,6 +642,21 @@ TEH_handler_purses_deposit (
return mhd_ret;
}
}
{
struct TALER_PurseEventP rep = {
.header.size = htons (sizeof (rep)),
.header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_DEPOSITED),
.purse_pub = *pcc.purse_pub
};
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Notifying about purse deposit %s\n",
TALER_B2S (pcc.purse_pub));
TEH_plugin->event_notify (TEH_plugin->cls,
&rep.header,
NULL,
0);
}
/* generate regular response */
{

View File

@ -176,6 +176,11 @@ db_event_cb (void *cls,
(void) extra;
(void) extra_size;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Waking up on %p - %p - %s\n",
rc,
gc,
gc->suspended ? "suspended" : "active");
if (NULL == gc)
return; /* event triggered while main transaction
was still running */
@ -280,13 +285,19 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
};
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Starting DB event listening\n");
"Starting DB event listening on purse %s\n",
TALER_B2S (&gc->purse_pub));
gc->eh = TEH_plugin->event_listen (
TEH_plugin->cls,
GNUNET_TIME_absolute_get_remaining (gc->timeout),
&rep.header,
&db_event_cb,
rc);
if (NULL == gc->eh)
{
GNUNET_break (0);
gc->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
}
}
} /* end first-time initialization */
@ -332,6 +343,9 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
gc->purse_expiration));
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Deposited amount is %s\n",
TALER_amount2s (&gc->deposited));
if (GNUNET_TIME_absolute_is_future (gc->timeout) &&
( ((gc->wait_for_merge) &&
GNUNET_TIME_absolute_is_never (gc->merge_timestamp.abs_time)) ||

View File

@ -308,22 +308,6 @@ merge_transaction (void *cls,
GNUNET_free (partner_url);
return GNUNET_DB_STATUS_HARD_ERROR;
}
{
struct TALER_PurseEventP rep = {
.header.size = htons (sizeof (rep)),
.header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_MERGED),
.purse_pub = *pcc->purse_pub
};
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Notifying about purse merge\n");
TEH_plugin->event_notify (TEH_plugin->cls,
&rep.header,
NULL,
0);
}
return qs;
}
@ -550,6 +534,21 @@ TEH_handler_purses_merge (
}
}
{
struct TALER_PurseEventP rep = {
.header.size = htons (sizeof (rep)),
.header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_MERGED),
.purse_pub = *pcc.purse_pub
};
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Notifying about purse merge\n");
TEH_plugin->event_notify (TEH_plugin->cls,
&rep.header,
NULL,
0);
}
GNUNET_free (pcc.provider_url);
/* generate regular response */
return reply_merge_success (connection,