diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-08-24 09:55:18 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-08-24 09:55:18 +0200 |
commit | bc107b59587d0f98d278c958ba775e215312b618 (patch) | |
tree | 590e6745a9ef197b9ee0f7e296ee31a37b6d3c58 /src/exchangedb/plugin_exchangedb_postgres.c | |
parent | 4edb5050d9904ece8520a44bd241328588584f46 (diff) | |
download | exchange-bc107b59587d0f98d278c958ba775e215312b618.tar.gz exchange-bc107b59587d0f98d278c958ba775e215312b618.tar.bz2 exchange-bc107b59587d0f98d278c958ba775e215312b618.zip |
-fix purse deposit when done against non-existing reserve
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 505f493e5..e3da5216b 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -908,8 +908,8 @@ prepare_statements (struct PostgresClosure *pg) " out_balance_ok AS balance_ok" ",out_conflict AS conflict" " FROM exchange_do_purse_deposit" - " ($1,$2,$3,$4,$5,$6,$7,$8);", - 8), + " ($1,$2,$3,$4,$5,$6,$7,$8,$9);", + 9), /* Used in #postgres_update_aggregation_transient() */ GNUNET_PQ_make_prepare ( "set_purse_balance", @@ -15875,6 +15875,7 @@ postgres_do_purse_deposit ( bool *conflict) { struct PostgresClosure *pg = cls; + struct GNUNET_TIME_Timestamp reserve_expiration; uint64_t partner_id = 0; /* FIXME #7271: WAD support... */ struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&partner_id), @@ -15883,6 +15884,7 @@ postgres_do_purse_deposit ( GNUNET_PQ_query_param_auto_from_type (coin_pub), GNUNET_PQ_query_param_auto_from_type (coin_sig), TALER_PQ_query_param_amount (amount_minus_fee), + GNUNET_PQ_query_param_timestamp (&reserve_expiration), GNUNET_PQ_query_param_end }; struct GNUNET_PQ_ResultSpec rs[] = { @@ -15893,6 +15895,10 @@ postgres_do_purse_deposit ( GNUNET_PQ_result_spec_end }; + reserve_expiration + = GNUNET_TIME_absolute_to_timestamp ( + GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), + pg->legal_reserve_expiration_time)); return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "call_purse_deposit", params, |