add reserve-open-deposit transactions to coin histories

This commit is contained in:
Christian Grothoff 2022-10-14 00:29:32 +02:00
parent 1ee69f6f1d
commit 5f333f817c
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 44 additions and 1 deletions

View File

@ -99,7 +99,6 @@ static struct Table tables[] = {
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OPEN_REQUESTS},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OPEN_DEPOSITS},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE_REQUESTS},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OUT},
{ .rt = TALER_EXCHANGEDB_RT_AUDITORS},
{ .rt = TALER_EXCHANGEDB_RT_AUDITOR_DENOM_SIGS},

View File

@ -424,6 +424,31 @@ TEH_RESPONSE_compile_transaction_history (
}
break;
}
case TALER_EXCHANGEDB_TT_RESERVE_OPEN:
{
struct TALER_EXCHANGEDB_ReserveOpenListEntry *role
= pos->details.reserve_open;
if (0 !=
json_array_append_new (
history,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("type",
"RESERVE-OPEN-DEPOSIT"),
TALER_JSON_pack_amount ("coin_contribution",
&role->coin_contribution),
GNUNET_JSON_pack_data_auto ("reserve_sig",
&role->reserve_sig),
GNUNET_JSON_pack_data_auto ("coin_sig",
&role->coin_sig))))
{
GNUNET_break (0);
json_decref (history);
return NULL;
}
break;
}
}
}
return history;

View File

@ -131,6 +131,17 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
}
deposit_fee = pos->details.purse_deposit->deposit_fee;
break;
case TALER_EXCHANGEDB_TT_RESERVE_OPEN:
/* spent += pos->amount_with_fee */
if (0 >
TALER_amount_add (&spent,
&spent,
&pos->details.reserve_open->coin_contribution))
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
break;
}
}
if (have_refund)

View File

@ -152,6 +152,14 @@ TEH_COMMON_free_coin_transaction_list (
GNUNET_free (deposit);
break;
}
case TALER_EXCHANGEDB_TT_RESERVE_OPEN:
{
struct TALER_EXCHANGEDB_ReserveOpenListEntry *role;
role = tl->details.reserve_open;
GNUNET_free (role);
break;
}
}
{
struct TALER_EXCHANGEDB_TransactionList *next;