return 204 on empty transaction history, as per API

This commit is contained in:
Christian Grothoff 2022-12-19 14:13:55 +01:00
parent d3a9160e0f
commit 80660f2d88
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 20 additions and 9 deletions

View File

@ -2312,14 +2312,21 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
pos = t; pos = t;
} }
} }
if (0 == ha.delta)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"No debit transactions exist after given starting point\n");
return TALER_MHD_reply_static (connection,
MHD_HTTP_NO_CONTENT,
NULL,
NULL,
0);
}
if (NULL != pos) if (NULL != pos)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Returning %lld debit transactions starting (inclusive) from %llu\n", "Returning %lld debit transactions starting (inclusive) from %llu\n",
(long long) ha.delta, (long long) ha.delta,
(unsigned long long) pos->row_id); (unsigned long long) pos->row_id);
else
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"No debit transactions exist after given starting point\n");
while ( (0 != ha.delta) && while ( (0 != ha.delta) &&
(NULL != pos) ) (NULL != pos) )
{ {
@ -2525,14 +2532,21 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
pos = t; pos = t;
} }
} }
if (0 == ha.delta)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"No credit transactions exist after given starting point\n");
return TALER_MHD_reply_static (connection,
MHD_HTTP_NO_CONTENT,
NULL,
NULL,
0);
}
if (NULL != pos) if (NULL != pos)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Returning %lld credit transactions starting (inclusive) from %llu\n", "Returning %lld credit transactions starting (inclusive) from %llu\n",
(long long) ha.delta, (long long) ha.delta,
(unsigned long long) pos->row_id); (unsigned long long) pos->row_id);
else
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"No credit transactions exist after given starting point\n");
while ( (0 != ha.delta) && while ( (0 != ha.delta) &&
(NULL != pos) ) (NULL != pos) )
{ {

View File

@ -576,9 +576,6 @@ parallel_benchmark (void)
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_OK ==
GNUNET_OS_process_wait (dbinit)); GNUNET_OS_process_wait (dbinit));
GNUNET_OS_process_destroy (dbinit); GNUNET_OS_process_destroy (dbinit);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Done with DB init with `%s'\n",
cfg_filename);
} }
/* start exchange wirewatch */ /* start exchange wirewatch */
for (unsigned int w = 0; w<start_wirewatch; w++) for (unsigned int w = 0; w<start_wirewatch; w++)