diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-07-28 19:01:57 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-07-28 19:01:57 +0200 |
commit | a1dae0199f3bc3e9f66fc1375c652c6f99b26b2c (patch) | |
tree | ae2be069b97117bf65eb681a58cf3d74cd3cd471 /src/exchangedb/exchange_do_recoup_to_reserve.sql | |
parent | 8f9731e83009f13a8b4e172aec1252bc79c4dee1 (diff) |
FAILING attempt to make echange.reserve use taler_amountfail-amount
Fails with
> TALER_PREFIX=/usr/local ./test-exchangedb-postgres
2023-07-28T19:02:25.150845+0200 /home/oec/projects/taler/exchange/src/exchangedb/.libs/test-exchangedb-postgres-2559159 WARNING Could not run PSQL on file /usr/local/share/taler//sql/exchange/drop.sql: psql exit code was 3
2023-07-28T19:02:32.488085+0200 pq-2559159 ERROR Query `call_withdraw' failed with result: invalid input syntax for type bigint:
"(1,1000)"/(null)/ERROR: invalid input syntax for type bigint: "(1,1000)"
CONTEXT: PL/pgSQL function exchange_do_withdraw(bytea,taler_amount,bytea,bytea,bytea,bytea,bytea,bigint,bigint,boolean) line 23 at SQL statement
/PGRES_FATAL_ERROR/ERROR: invalid input syntax for type bigint: "(1,1000)"
CONTEXT: PL/pgSQL function exchange_do_withdraw(bytea,taler_amount,bytea,bytea,bytea,bytea,bytea,bigint,bigint,boolean) line 23 at SQL statement
2023-07-28T19:02:32.488146+0200 /home/oec/projects/taler/exchange/src/exchangedb/.libs/test-exchangedb-postgres-2559159 ERROR Assertion failed at test_exchangedb.c:1428.
Diffstat (limited to 'src/exchangedb/exchange_do_recoup_to_reserve.sql')
-rw-r--r-- | src/exchangedb/exchange_do_recoup_to_reserve.sql | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/exchangedb/exchange_do_recoup_to_reserve.sql b/src/exchangedb/exchange_do_recoup_to_reserve.sql index 39baba8f..72942e8c 100644 --- a/src/exchangedb/exchange_do_recoup_to_reserve.sql +++ b/src/exchangedb/exchange_do_recoup_to_reserve.sql @@ -31,9 +31,7 @@ CREATE OR REPLACE FUNCTION exchange_do_recoup_to_reserve( LANGUAGE plpgsql AS $$ DECLARE - tmp_val INT8; -- amount recouped -DECLARE - tmp_frac INT8; -- amount recouped + tmp taler_amount; -- amount recouped BEGIN -- Shards: SELECT known_coins (by coin_pub) -- SELECT recoup (by coin_pub) @@ -49,8 +47,8 @@ SELECT remaining_frac ,remaining_val INTO - tmp_frac - ,tmp_val + tmp.frac + ,tmp.val FROM exchange.known_coins WHERE coin_pub=in_coin_pub; @@ -61,7 +59,7 @@ THEN RETURN; END IF; -IF tmp_val + tmp_frac = 0 +IF tmp.val + tmp.frac = 0 THEN -- Check for idempotency SELECT @@ -87,15 +85,15 @@ UPDATE known_coins -- Credit the reserve and update reserve timers. UPDATE reserves SET - current_balance_frac=current_balance_frac+tmp_frac + current_balance.frac=current_balance.frac+tmp.frac - CASE - WHEN current_balance_frac+tmp_frac >= 100000000 + WHEN current_balance.frac+tmp.frac >= 100000000 THEN 100000000 ELSE 0 END, - current_balance_val=current_balance_val+tmp_val + current_balance.val=current_balance.val+tmp.val + CASE - WHEN current_balance_frac+tmp_frac >= 100000000 + WHEN current_balance.frac+tmp.frac >= 100000000 THEN 1 ELSE 0 END, @@ -126,8 +124,8 @@ VALUES (in_coin_pub ,in_coin_sig ,in_coin_blind - ,tmp_val - ,tmp_frac + ,tmp.val + ,tmp.frac ,in_recoup_timestamp ,in_reserve_out_serial_id); |