gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-donau] branch master updated: [db] cleanup, working on pg headers


From: gnunet
Subject: [taler-donau] branch master updated: [db] cleanup, working on pg headers
Date: Mon, 23 Oct 2023 21:50:19 +0200

This is an automated email from the git hooks/post-receive script.

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 59bc1f6  [db] cleanup, working on pg headers
59bc1f6 is described below

commit 59bc1f6ff1d9f665678dffcdd607616463be32eb
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Mon Oct 23 21:49:48 2023 +0200

    [db] cleanup, working on pg headers
---
 src/donaudb/donau_do_account_merge.sql             |  15 -
 src/donaudb/donau_do_amount_specific.sql           |  78 ----
 src/donaudb/donau_do_batch_coin_known.sql          | 469 ---------------------
 src/donaudb/donau_do_batch_reserves_update.sql     |  72 ----
 src/donaudb/donau_do_batch_withdraw.sql            | 123 ------
 src/donaudb/donau_do_batch_withdraw_insert.sql     | 120 ------
 src/donaudb/donau_do_deposit.sql                   | 207 ---------
 src/donaudb/donau_do_reserves_in_insert.sql        | 123 ------
 src/donaudb/donau_do_withdraw.sql                  | 213 ----------
 src/donaudb/pg_activate_signing_key.c              |   3 +-
 src/donaudb/pg_add_donation_unit_key.c             |  68 +--
 src/donaudb/pg_add_donation_unit_key.h             |   4 +-
 src/donaudb/pg_count_known_coins.h                 |  39 --
 src/donaudb/pg_get_denomination_info.c             |  91 ----
 ...t_known_coins.c => pg_get_donation_unit_info.c} |  50 ++-
 ...mination_info.h => pg_get_donation_unit_info.h} |   2 +-
 src/donaudb/pg_insert_charity.c                    |  60 +++
 ...ert_denomination_info.h => pg_insert_charity.h} |  30 +-
 src/donaudb/pg_insert_denomination_info.c          | 101 -----
 src/include/taler_donaudb_plugin.h                 |   5 +-
 20 files changed, 129 insertions(+), 1744 deletions(-)

diff --git a/src/donaudb/donau_do_account_merge.sql 
b/src/donaudb/donau_do_account_merge.sql
deleted file mode 100644
index 5932fa4..0000000
--- a/src/donaudb/donau_do_account_merge.sql
+++ /dev/null
@@ -1,15 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
diff --git a/src/donaudb/donau_do_amount_specific.sql 
b/src/donaudb/donau_do_amount_specific.sql
deleted file mode 100644
index e8f60f4..0000000
--- a/src/donaudb/donau_do_amount_specific.sql
+++ /dev/null
@@ -1,78 +0,0 @@
---------------------------------------------------------------
--- Taler amounts and helper functions
--------------------------------------------------------------
-
-CREATE OR REPLACE FUNCTION amount_normalize(
-    IN amount taler_amount
-  ,OUT normalized taler_amount
-)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-  normalized.val = amount.val + amount.frac / 100000000;
-  normalized.frac = amount.frac % 100000000;
-END $$;
-
-COMMENT ON FUNCTION amount_normalize
-  IS 'Returns the normalized amount by adding to the .val the value of (.frac 
/ 100000000) and removing the modulus 100000000 from .frac.';
-
-CREATE OR REPLACE FUNCTION amount_add(
-   IN a taler_amount
-  ,IN b taler_amount
-  ,OUT sum taler_amount
-)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-  sum = (a.val + b.val, a.frac + b.frac);
-  CALL amount_normalize(sum ,sum);
-
-  IF (sum.val > (1<<52))
-  THEN
-    RAISE EXCEPTION 'addition overflow';
-  END IF;
-END $$;
-
-COMMENT ON FUNCTION amount_add
-  IS 'Returns the normalized sum of two amounts. It raises an exception when 
the resulting .val is larger than 2^52';
-
-CREATE OR REPLACE FUNCTION amount_left_minus_right(
-  IN  l taler_amount
- ,IN  r taler_amount
- ,OUT diff taler_amount
- ,OUT ok BOOLEAN
-)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-
-IF (l.val > r.val)
-THEN
-  ok = TRUE;
-  IF (l.frac >= r.frac)
-  THEN
-    diff.val  = l.val  - r.val;
-    diff.frac = l.frac - r.frac;
-  ELSE
-    diff.val  = l.val  - r.val - 1;
-    diff.frac = l.frac + 100000000 - r.frac;
-  END IF;
-ELSE
-  IF (l.val = r.val) AND (l.frac >= r.frac)
-  THEN
-    diff.val  = 0;
-    diff.frac = l.frac - r.frac;
-    ok = TRUE;
-  ELSE
-    diff = (-1, -1);
-    ok = FALSE;
-  END IF;
-END IF;
-
-RETURN;
-END $$;
-
-COMMENT ON FUNCTION amount_left_minus_right
-  IS 'Subtracts the right amount from the left and returns the difference and 
TRUE, if the left amount is larger than the right, or an invalid amount and 
FALSE otherwise.';
-
-
diff --git a/src/donaudb/donau_do_batch_coin_known.sql 
b/src/donaudb/donau_do_batch_coin_known.sql
deleted file mode 100644
index ac9853c..0000000
--- a/src/donaudb/donau_do_batch_coin_known.sql
+++ /dev/null
@@ -1,469 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE OR REPLACE FUNCTION donau_do_batch4_known_coin(
-  IN in_coin_pub1 BYTEA,
-  IN in_denom_pub_hash1 BYTEA,
-  IN in_h_age_commitment1 BYTEA,
-  IN in_denom_sig1 BYTEA,
-  IN in_coin_pub2 BYTEA,
-  IN in_denom_pub_hash2 BYTEA,
-  IN in_h_age_commitment2 BYTEA,
-  IN in_denom_sig2 BYTEA,
-  IN in_coin_pub3 BYTEA,
-  IN in_denom_pub_hash3 BYTEA,
-  IN in_h_age_commitment3 BYTEA,
-  IN in_denom_sig3 BYTEA,
-  IN in_coin_pub4 BYTEA,
-  IN in_denom_pub_hash4 BYTEA,
-  IN in_h_age_commitment4 BYTEA,
-  IN in_denom_sig4 BYTEA,
-  OUT existed1 BOOLEAN,
-  OUT existed2 BOOLEAN,
-  OUT existed3 BOOLEAN,
-  OUT existed4 BOOLEAN,
-  OUT known_coin_id1 INT8,
-  OUT known_coin_id2 INT8,
-  OUT known_coin_id3 INT8,
-  OUT known_coin_id4 INT8,
-  OUT denom_pub_hash1 BYTEA,
-  OUT denom_pub_hash2 BYTEA,
-  OUT denom_pub_hash3 BYTEA,
-  OUT denom_pub_hash4 BYTEA,
-  OUT age_commitment_hash1 BYTEA,
-  OUT age_commitment_hash2 BYTEA,
-  OUT age_commitment_hash3 BYTEA,
-  OUT age_commitment_hash4 BYTEA)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-WITH dd AS (
-SELECT
-  denominations_serial,
-  coin
-  FROM denominations
-    WHERE denom_pub_hash
-    IN
-     (in_denom_pub_hash1,
-      in_denom_pub_hash2,
-      in_denom_pub_hash3,
-      in_denom_pub_hash4)
-     ),--dd
-     input_rows AS (
-     VALUES
-      (in_coin_pub1,
-      in_denom_pub_hash1,
-      in_h_age_commitment1,
-      in_denom_sig1),
-      (in_coin_pub2,
-      in_denom_pub_hash2,
-      in_h_age_commitment2,
-      in_denom_sig2),
-      (in_coin_pub3,
-      in_denom_pub_hash3,
-      in_h_age_commitment3,
-      in_denom_sig3),
-      (in_coin_pub4,
-      in_denom_pub_hash4,
-      in_h_age_commitment4,
-      in_denom_sig4)
-      ),--ir
-      ins AS (
-      INSERT INTO known_coins (
-      coin_pub,
-      denominations_serial,
-      age_commitment_hash,
-      denom_sig,
-      remaining
-      )
-      SELECT
-        ir.coin_pub,
-        dd.denominations_serial,
-        ir.age_commitment_hash,
-        ir.denom_sig,
-        dd.coin
-        FROM input_rows ir
-        JOIN dd
-          ON dd.denom_pub_hash = ir.denom_pub_hash
-          ON CONFLICT DO NOTHING
-          RETURNING known_coin_id
-      ),--kc
-       exists AS (
-         SELECT
-         CASE
-           WHEN
-             ins.known_coin_id IS NOT NULL
-             THEN
-               FALSE
-             ELSE
-               TRUE
-         END AS existed,
-         ins.known_coin_id,
-         dd.denom_pub_hash,
-         kc.age_commitment_hash
-         FROM input_rows ir
-         LEFT JOIN ins
-           ON ins.coin_pub = ir.coin_pub
-         LEFT JOIN known_coins kc
-           ON kc.coin_pub = ir.coin_pub
-         LEFT JOIN dd
-           ON dd.denom_pub_hash = ir.denom_pub_hash
-         )--exists
-SELECT
- exists.existed AS existed1,
- exists.known_coin_id AS known_coin_id1,
- exists.denom_pub_hash AS denom_pub_hash1,
- exists.age_commitment_hash AS age_commitment_hash1,
- (
-   SELECT exists.existed
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- ) AS existed2,
- (
-   SELECT exists.known_coin_id
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- ) AS known_coin_id2,
- (
-   SELECT exists.denom_pub_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- ) AS denom_pub_hash2,
- (
-   SELECT exists.age_commitment_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- )AS age_commitment_hash2,
- (
-   SELECT exists.existed
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash3
- ) AS existed3,
- (
-   SELECT exists.known_coin_id
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash3
- ) AS known_coin_id3,
- (
-   SELECT exists.denom_pub_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash3
- ) AS denom_pub_hash3,
- (
-   SELECT exists.age_commitment_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash3
- )AS age_commitment_hash3,
- (
-   SELECT exists.existed
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash4
- ) AS existed4,
- (
-   SELECT exists.known_coin_id
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash4
- ) AS known_coin_id4,
- (
-   SELECT exists.denom_pub_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash4
- ) AS denom_pub_hash4,
- (
-   SELECT exists.age_commitment_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash4
- )AS age_commitment_hash4
-FROM exists;
-
-RETURN;
-END $$;
-
-
-CREATE OR REPLACE FUNCTION donau_do_batch2_known_coin(
-  IN in_coin_pub1 BYTEA,
-  IN in_denom_pub_hash1 BYTEA,
-  IN in_h_age_commitment1 BYTEA,
-  IN in_denom_sig1 BYTEA,
-  IN in_coin_pub2 BYTEA,
-  IN in_denom_pub_hash2 BYTEA,
-  IN in_h_age_commitment2 BYTEA,
-  IN in_denom_sig2 BYTEA,
-  OUT existed1 BOOLEAN,
-  OUT existed2 BOOLEAN,
-  OUT known_coin_id1 INT8,
-  OUT known_coin_id2 INT8,
-  OUT denom_pub_hash1 BYTEA,
-  OUT denom_pub_hash2 BYTEA,
-  OUT age_commitment_hash1 BYTEA,
-  OUT age_commitment_hash2 BYTEA)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-WITH dd AS (
-SELECT
-  denominations_serial,
-  coin
-  FROM denominations
-    WHERE denom_pub_hash
-    IN
-     (in_denom_pub_hash1,
-      in_denom_pub_hash2)
-     ),--dd
-     input_rows AS (
-     VALUES
-      (in_coin_pub1,
-      in_denom_pub_hash1,
-      in_h_age_commitment1,
-      in_denom_sig1),
-      (in_coin_pub2,
-      in_denom_pub_hash2,
-      in_h_age_commitment2,
-      in_denom_sig2)
-      ),--ir
-      ins AS (
-      INSERT INTO known_coins (
-      coin_pub,
-      denominations_serial,
-      age_commitment_hash,
-      denom_sig,
-      remaining
-      )
-      SELECT
-        ir.coin_pub,
-        dd.denominations_serial,
-        ir.age_commitment_hash,
-        ir.denom_sig,
-        dd.coin
-        FROM input_rows ir
-        JOIN dd
-          ON dd.denom_pub_hash = ir.denom_pub_hash
-          ON CONFLICT DO NOTHING
-          RETURNING known_coin_id
-      ),--kc
-       exists AS (
-       SELECT
-        CASE
-          WHEN ins.known_coin_id IS NOT NULL
-          THEN
-            FALSE
-          ELSE
-            TRUE
-        END AS existed,
-        ins.known_coin_id,
-        dd.denom_pub_hash,
-        kc.age_commitment_hash
-        FROM input_rows ir
-        LEFT JOIN ins
-          ON ins.coin_pub = ir.coin_pub
-        LEFT JOIN known_coins kc
-          ON kc.coin_pub = ir.coin_pub
-        LEFT JOIN dd
-          ON dd.denom_pub_hash = ir.denom_pub_hash
-     )--exists
-SELECT
- exists.existed AS existed1,
- exists.known_coin_id AS known_coin_id1,
- exists.denom_pub_hash AS denom_pub_hash1,
- exists.age_commitment_hash AS age_commitment_hash1,
- (
-   SELECT exists.existed
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- ) AS existed2,
- (
-   SELECT exists.known_coin_id
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- ) AS known_coin_id2,
- (
-   SELECT exists.denom_pub_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- ) AS denom_pub_hash2,
- (
-   SELECT exists.age_commitment_hash
-   FROM exists
-   WHERE exists.denom_pub_hash = in_denom_pub_hash2
- )AS age_commitment_hash2
-FROM exists;
-
-RETURN;
-END $$;
-
-
-CREATE OR REPLACE FUNCTION donau_do_batch1_known_coin(
-  IN in_coin_pub1 BYTEA,
-  IN in_denom_pub_hash1 BYTEA,
-  IN in_h_age_commitment1 BYTEA,
-  IN in_denom_sig1 BYTEA,
-  OUT existed1 BOOLEAN,
-  OUT known_coin_id1 INT8,
-  OUT denom_pub_hash1 BYTEA,
-  OUT age_commitment_hash1 BYTEA)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-WITH dd AS (
-SELECT
-  denominations_serial,
-  coin
-  FROM denominations
-    WHERE denom_pub_hash
-    IN
-     (in_denom_pub_hash1,
-      in_denom_pub_hash2)
-     ),--dd
-     input_rows AS (
-     VALUES
-      (in_coin_pub1,
-      in_denom_pub_hash1,
-      in_h_age_commitment1,
-      in_denom_sig1)
-      ),--ir
-      ins AS (
-      INSERT INTO known_coins (
-      coin_pub,
-      denominations_serial,
-      age_commitment_hash,
-      denom_sig,
-      remaining
-      )
-      SELECT
-        ir.coin_pub,
-        dd.denominations_serial,
-        ir.age_commitment_hash,
-        ir.denom_sig,
-        dd.coin
-        FROM input_rows ir
-        JOIN dd
-          ON dd.denom_pub_hash = ir.denom_pub_hash
-          ON CONFLICT DO NOTHING
-          RETURNING known_coin_id
-      ),--kc
-       exists AS (
-       SELECT
-        CASE
-          WHEN ins.known_coin_id IS NOT NULL
-          THEN
-            FALSE
-          ELSE
-            TRUE
-        END AS existed,
-        ins.known_coin_id,
-        dd.denom_pub_hash,
-        kc.age_commitment_hash
-        FROM input_rows ir
-        LEFT JOIN ins
-          ON ins.coin_pub = ir.coin_pub
-        LEFT JOIN known_coins kc
-          ON kc.coin_pub = ir.coin_pub
-        LEFT JOIN dd
-          ON dd.denom_pub_hash = ir.denom_pub_hash
-       )--exists
-SELECT
- exists.existed AS existed1,
- exists.known_coin_id AS known_coin_id1,
- exists.denom_pub_hash AS denom_pub_hash1,
- exists.age_commitment_hash AS age_commitment_hash1
-FROM exists;
-
-RETURN;
-END $$;
-
-/*** Experiment using a loop ***/
-/*
-CREATE OR REPLACE FUNCTION donau_do_batch2_known_coin(
-  IN in_coin_pub1 BYTEA,
-  IN in_denom_pub_hash1 TEXT,
-  IN in_h_age_commitment1 TEXT,
-  IN in_denom_sig1 TEXT,
-  IN in_coin_pub2 BYTEA,
-  IN in_denom_pub_hash2 TEXT,
-  IN in_h_age_commitment2 TEXT,
-  IN in_denom_sig2 TEXT,
-  OUT existed1 BOOLEAN,
-  OUT existed2 BOOLEAN,
-  OUT known_coin_id1 INT8,
-  OUT known_coin_id2 INT8,
-  OUT denom_pub_hash1 TEXT,
-  OUT denom_pub_hash2 TEXT,
-  OUT age_commitment_hash1 TEXT,
-  OUT age_commitment_hash2 TEXT)
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  ins_values RECORD;
-BEGIN
-  FOR i IN 1..2 LOOP
-    ins_values := (
-      SELECT
-        in_coin_pub1 AS coin_pub,
-        in_denom_pub_hash1 AS denom_pub_hash,
-        in_h_age_commitment1 AS age_commitment_hash,
-        in_denom_sig1 AS denom_sig
-      WHERE i = 1
-      UNION
-      SELECT
-        in_coin_pub2 AS coin_pub,
-        in_denom_pub_hash2 AS denom_pub_hash,
-        in_h_age_commitment2 AS age_commitment_hash,
-        in_denom_sig2 AS denom_sig
-      WHERE i = 2
-    );
-    WITH dd (denominations_serial, coin) AS (
-      SELECT denominations_serial, coin
-      FROM denominations
-      WHERE denom_pub_hash = ins_values.denom_pub_hash
-    ),
-    input_rows(coin_pub) AS (
-      VALUES (ins_values.coin_pub)
-    ),
-    ins AS (
-      INSERT INTO known_coins (
-        coin_pub,
-        denominations_serial,
-        age_commitment_hash,
-        denom_sig,
-        remaining
-      ) SELECT
-        input_rows.coin_pub,
-        dd.denominations_serial,
-        ins_values.age_commitment_hash,
-        ins_values.denom_sig,
-        coin
-      FROM dd
-      CROSS JOIN input_rows
-      ON CONFLICT DO NOTHING
-      RETURNING known_coin_id, denom_pub_hash
-    )
-    SELECT
-      CASE i
-        WHEN 1 THEN
-          COALESCE(ins.known_coin_id, 0) <> 0 AS existed1,
-          ins.known_coin_id AS known_coin_id1,
-          ins.denom_pub_hash AS denom_pub_hash1,
-          ins.age_commitment_hash AS age_commitment_hash1
-        WHEN 2 THEN
-          COALESCE(ins.known_coin_id, 0) <> 0 AS existed2,
-          ins.known_coin_id AS known_coin_id2,
-          ins.denom_pub_hash AS denom_pub_hash2,
-          ins.age_commitment_hash AS age_commitment_hash2
-      END
-    FROM ins;
-  END LOOP;
-END;
-$$;*/
diff --git a/src/donaudb/donau_do_batch_reserves_update.sql 
b/src/donaudb/donau_do_batch_reserves_update.sql
deleted file mode 100644
index ad702fc..0000000
--- a/src/donaudb/donau_do_batch_reserves_update.sql
+++ /dev/null
@@ -1,72 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE OR REPLACE FUNCTION donau_do_batch_reserves_update(
-  IN in_reserve_pub BYTEA,
-  IN in_expiration_date INT8,
-  IN in_wire_ref INT8,
-  IN in_credit taler_amount,
-  IN in_donau_account_name TEXT,
-  IN in_wire_source_h_payto BYTEA,
-  IN in_notify text,
-  OUT out_duplicate BOOLEAN)
-LANGUAGE plpgsql
-AS $$
-BEGIN
-  INSERT INTO reserves_in
-    (reserve_pub
-    ,wire_reference
-    ,credit
-    ,donau_account_section
-    ,wire_source_h_payto
-    ,execution_date)
-    VALUES
-    (in_reserve_pub
-    ,in_wire_ref
-    ,in_credit
-    ,in_donau_account_name
-    ,in_wire_source_h_payto
-    ,in_expiration_date)
-    ON CONFLICT DO NOTHING;
-  IF FOUND
-  THEN
-    --IF THE INSERTION WAS A SUCCESS IT MEANS NO DUPLICATED TRANSACTION
-    out_duplicate = FALSE;
-    UPDATE reserves rs
-      SET
-         current_balance.frac = (rs.current_balance).frac+in_credit.frac
-           - CASE
-             WHEN (rs.current_balance).frac + in_credit.frac >= 100000000
-               THEN 100000000
-             ELSE 1
-             END
-        ,current_balance.val = (rs.current_balance).val+in_credit.val
-           + CASE
-             WHEN (rs.current_balance).frac + in_credit.frac >= 100000000
-               THEN 1
-             ELSE 0
-             END
-             ,expiration_date=GREATEST(expiration_date,in_expiration_date)
-             ,gc_date=GREATEST(gc_date,in_expiration_date)
-               WHERE reserve_pub=in_reserve_pub;
-    EXECUTE FORMAT (
-      'NOTIFY %s'
-      ,in_notify);
-  ELSE
-    out_duplicate = TRUE;
-  END IF;
-  RETURN;
-END $$;
diff --git a/src/donaudb/donau_do_batch_withdraw.sql 
b/src/donaudb/donau_do_batch_withdraw.sql
deleted file mode 100644
index 4e18baf..0000000
--- a/src/donaudb/donau_do_batch_withdraw.sql
+++ /dev/null
@@ -1,123 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2023 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
--- @author Christian Grothoff
--- @author Özgür Kesim
-
-CREATE OR REPLACE FUNCTION donau_do_batch_withdraw(
-  IN amount taler_amount,
-  IN rpub BYTEA,
-  IN now INT8,
-  IN min_reserve_gc INT8,
-  IN do_age_check BOOLEAN,
-  OUT reserve_found BOOLEAN,
-  OUT balance_ok BOOLEAN,
-  OUT age_ok BOOLEAN,
-  OUT allowed_maximum_age INT2, -- in years
-  OUT ruuid INT8)
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  reserve RECORD;
-  balance taler_amount;
-  not_before date;
-BEGIN
--- Shards: reserves by reserve_pub (SELECT)
---         reserves_out (INSERT, with CONFLICT detection) by wih
---         reserves by reserve_pub (UPDATE)
---         reserves_in by reserve_pub (SELECT)
---         wire_targets by wire_target_h_payto
-
-
-SELECT *
-  INTO reserve
-  FROM donau.reserves
- WHERE reserves.reserve_pub=rpub;
-
-IF NOT FOUND
-THEN
-  -- reserve unknown
-  reserve_found=FALSE;
-  balance_ok=FALSE;
-  age_ok=FALSE;
-  allowed_maximum_age=0;
-  ruuid=2;
-  RETURN;
-END IF;
-
-ruuid = reserve.reserve_uuid;
-
--- Check if age requirements are present
-IF ((NOT do_age_check) OR (reserve.birthday = 0))
-THEN
-  age_ok = TRUE;
-  allowed_maximum_age = -1;
-ELSE
-  -- Age requirements are formally not met:  The donau is setup to support
-  -- age restrictions (do_age_check == TRUE) and the reserve has a
-  -- birthday set (reserve_birthday != 0), but the client called the
-  -- batch-withdraw endpoint instead of the age-withdraw endpoint, which it
-  -- should have.
-  not_before=date '1970-01-01' + reserve.birthday;
-  allowed_maximum_age = extract(year from age(current_date, not_before));
-
-  reserve_found=TRUE;
-  balance_ok=FALSE;
-  age_ok = FALSE;
-  RETURN;
-END IF;
-
-balance = reserve.current_balance;
-
--- Check reserve balance is sufficient.
-IF (balance.val > amount.val)
-THEN
-  IF (balance.frac >= amount.frac)
-  THEN
-    balance.val=balance.val - amount.val;
-    balance.frac=balance.frac - amount.frac;
-  ELSE
-    balance.val=balance.val - amount.val - 1;
-    balance.frac=balance.frac + 100000000 - amount.frac;
-  END IF;
-ELSE
-  IF (balance.val = amount.val) AND (balance.frac >= amount.frac)
-  THEN
-    balance.val=0;
-    balance.frac=balance.frac - amount.frac;
-  ELSE
-    balance_ok=FALSE;
-    RETURN;
-  END IF;
-END IF;
-
--- Calculate new expiration dates.
-min_reserve_gc=GREATEST(min_reserve_gc,reserve.gc_date);
-
--- Update reserve balance.
-UPDATE reserves SET
-  gc_date=min_reserve_gc
- ,current_balance=balance
-WHERE
-  reserves.reserve_pub=rpub;
-
-reserve_found=TRUE;
-balance_ok=TRUE;
-
-END $$;
-
-COMMENT ON FUNCTION donau_do_batch_withdraw(taler_amount, BYTEA, INT8, INT8, 
BOOLEAN)
-  IS 'Checks whether the reserve has sufficient balance for a withdraw 
operation (or the request is repeated and was previously approved) and that age 
requirements are formally met. If so updates the database with the result. 
Excludes storing the planchets.';
-
diff --git a/src/donaudb/donau_do_batch_withdraw_insert.sql 
b/src/donaudb/donau_do_batch_withdraw_insert.sql
deleted file mode 100644
index 7803cc5..0000000
--- a/src/donaudb/donau_do_batch_withdraw_insert.sql
+++ /dev/null
@@ -1,120 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE OR REPLACE FUNCTION donau_do_batch_withdraw_insert(
-  IN cs_nonce BYTEA,
-  IN amount taler_amount,
-  IN h_denom_pub BYTEA, -- FIXME: denom_serials should really be a parameter 
to this FUNCTION.
-  IN ruuid INT8,
-  IN reserve_sig BYTEA,
-  IN h_coin_envelope BYTEA,
-  IN denom_sig BYTEA,
-  IN now INT8,
-  OUT out_denom_unknown BOOLEAN,
-  OUT out_nonce_reuse BOOLEAN,
-  OUT out_conflict BOOLEAN)
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  denom_serial INT8;
-BEGIN
--- Shards: reserves by reserve_pub (SELECT)
---         reserves_out (INSERT, with CONFLICT detection) by wih
---         reserves by reserve_pub (UPDATE)
---         reserves_in by reserve_pub (SELECT)
---         wire_targets by wire_target_h_payto
-
-out_denom_unknown=TRUE;
-out_conflict=TRUE;
-out_nonce_reuse=TRUE;
-
--- FIXME: denom_serials should really be a parameter to this FUNCTION.
-
-SELECT denominations_serial
-  INTO denom_serial
-  FROM donau.denominations
- WHERE denom_pub_hash=h_denom_pub;
-
-IF NOT FOUND
-THEN
-  -- denomination unknown, should be impossible!
-  out_denom_unknown=TRUE;
-  ASSERT false, 'denomination unknown';
-  RETURN;
-END IF;
-out_denom_unknown=FALSE;
-
-INSERT INTO donau.reserves_out
-  (h_blind_ev
-  ,denominations_serial
-  ,denom_sig
-  ,reserve_uuid
-  ,reserve_sig
-  ,execution_date
-  ,amount_with_fee)
-VALUES
-  (h_coin_envelope
-  ,denom_serial
-  ,denom_sig
-  ,ruuid
-  ,reserve_sig
-  ,now
-  ,amount)
-ON CONFLICT DO NOTHING;
-
-IF NOT FOUND
-THEN
-  out_conflict=TRUE;
-  RETURN;
-END IF;
-out_conflict=FALSE;
-
--- Special actions needed for a CS withdraw?
-out_nonce_reuse=FALSE;
-IF NOT NULL cs_nonce
-THEN
-  -- Cache CS signature to prevent replays in the future
-  -- (and check if cached signature exists at the same time).
-  INSERT INTO donau.cs_nonce_locks
-    (nonce
-    ,max_denomination_serial
-    ,op_hash)
-  VALUES
-    (cs_nonce
-    ,denom_serial
-    ,h_coin_envelope)
-  ON CONFLICT DO NOTHING;
-
-  IF NOT FOUND
-  THEN
-    -- See if the existing entry is identical.
-    SELECT 1
-      FROM donau.cs_nonce_locks
-     WHERE nonce=cs_nonce
-       AND op_hash=h_coin_envelope;
-    IF NOT FOUND
-    THEN
-      out_nonce_reuse=TRUE;
-      ASSERT false, 'nonce reuse attempted by client';
-      RETURN;
-    END IF;
-  END IF;
-END IF;
-
-END $$;
-
-COMMENT ON FUNCTION donau_do_batch_withdraw_insert(BYTEA, taler_amount, BYTEA, 
INT8, BYTEA, BYTEA, BYTEA, INT8)
-  IS 'Stores information about a planchet for a batch withdraw operation. 
Checks if the planchet already exists, and in that case indicates a conflict';
diff --git a/src/donaudb/donau_do_deposit.sql b/src/donaudb/donau_do_deposit.sql
deleted file mode 100644
index 1dbd269..0000000
--- a/src/donaudb/donau_do_deposit.sql
+++ /dev/null
@@ -1,207 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2023 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-CREATE OR REPLACE FUNCTION donau_do_deposit(
-  -- For batch_deposits
-  IN in_shard INT8,
-  IN in_charity_pub BYTEA,
-  IN in_wallet_timestamp INT8,
-  IN in_donau_timestamp INT8,
-  IN in_refund_deadline INT8,
-  IN in_wire_deadline INT8,
-  IN in_h_contract_terms BYTEA,
-  IN in_wallet_data_hash BYTEA, -- can be NULL
-  IN in_wire_salt BYTEA,
-  IN in_wire_target_h_payto BYTEA,
-  IN in_policy_details_serial_id INT8, -- can be NULL
-  IN in_policy_blocked BOOLEAN,
-  -- For wire_targets
-  IN in_receiver_wire_account TEXT,
-  -- For coin_deposits
-  IN ina_coin_pub BYTEA[],
-  IN ina_coin_sig BYTEA[],
-  IN ina_amount_with_fee taler_amount[],
-  OUT out_donau_timestamp INT8,
-  OUT out_insufficient_balance_coin_index INT4, -- index of coin with bad 
balance, NULL if none
-  OUT out_conflict BOOL
- )
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  wtsi INT8; -- wire target serial id
-  bdsi INT8; -- batch_deposits serial id
-  curs REFCURSOR;
-  i INT4;
-  ini_amount_with_fee taler_amount;
-  ini_coin_pub BYTEA;
-  ini_coin_sig BYTEA;
-BEGIN
--- Shards:
---         INSERT wire_targets (by h_payto), ON CONFLICT DO NOTHING;
---         INSERT batch_deposits (by shard, charity_pub), ON CONFLICT 
idempotency check;
---         INSERT[] coin_deposits (by coin_pub), ON CONFLICT idempotency check;
---         UPDATE[] known_coins (by coin_pub)
-
-
--- First, get or create the 'wtsi'
-INSERT INTO wire_targets
-    (wire_target_h_payto
-    ,payto_uri)
-  VALUES
-    (in_wire_target_h_payto
-    ,in_receiver_wire_account)
-  ON CONFLICT DO NOTHING -- for CONFLICT ON (wire_target_h_payto)
-  RETURNING
-    wire_target_serial_id
-  INTO
-    wtsi;
-
-IF NOT FOUND
-THEN
-  SELECT
-    wire_target_serial_id
-  INTO
-    wtsi
-  FROM wire_targets
-  WHERE
-    wire_target_h_payto=in_wire_target_h_payto;
-END IF;
-
-
--- Second, create the batch_deposits entry
-INSERT INTO batch_deposits
-  (shard
-  ,charity_pub
-  ,wallet_timestamp
-  ,donau_timestamp
-  ,refund_deadline
-  ,wire_deadline
-  ,h_contract_terms
-  ,wallet_data_hash
-  ,wire_salt
-  ,wire_target_h_payto
-  ,policy_details_serial_id
-  ,policy_blocked
-  )
-  VALUES
-  (in_shard
-  ,in_charity_pub
-  ,in_wallet_timestamp
-  ,in_donau_timestamp
-  ,in_refund_deadline
-  ,in_wire_deadline
-  ,in_h_contract_terms
-  ,in_wallet_data_hash
-  ,in_wire_salt
-  ,in_wire_target_h_payto
-  ,in_policy_details_serial_id
-  ,in_policy_blocked)
-  ON CONFLICT DO NOTHING -- for CONFLICT ON (charity_pub, h_contract_terms)
-  RETURNING
-    batch_deposit_serial_id
-  INTO
-    bdsi;
-
-IF NOT FOUND
-THEN
-  -- Idempotency check: see if an identical record exists.
-  -- We do select over charity_pub, h_contract_terms and wire_target_h_payto
-  -- first to maximally increase the chance of using the existing index.
-  SELECT
-      donau_timestamp
-     ,batch_deposit_serial_id
-   INTO
-      out_donau_timestamp
-     ,bdsi
-   FROM batch_deposits
-   WHERE shard=in_shard
-     AND charity_pub=in_charity_pub
-     AND h_contract_terms=in_h_contract_terms
-     AND wire_target_h_payto=in_wire_target_h_payto
-     -- now check the rest, too
-     AND ( (wallet_data_hash=in_wallet_data_hash) OR
-           (wallet_data_hash IS NULL AND in_wallet_data_hash IS NULL) )
-     AND wire_salt=in_wire_salt
-     AND wallet_timestamp=in_wallet_timestamp
-     AND refund_deadline=in_refund_deadline
-     AND wire_deadline=in_wire_deadline
-     AND ( (policy_details_serial_id=in_policy_details_serial_id) OR
-           (policy_details_serial_id IS NULL AND in_policy_details_serial_id 
IS NULL) );
-  IF NOT FOUND
-  THEN
-    -- Deposit exists, but with *strange* differences. Not allowed.
-    out_conflict=TRUE;
-    RETURN;
-  END IF;
-END IF;
-
-out_conflict=FALSE;
-
--- Deposit each coin
-
-FOR i IN 1..array_length(ina_coin_pub,1)
-LOOP
-  ini_coin_pub = ina_coin_pub[i];
-  ini_coin_sig = ina_coin_sig[i];
-  ini_amount_with_fee = ina_amount_with_fee[i];
-
-  INSERT INTO coin_deposits
-    (batch_deposit_serial_id
-    ,coin_pub
-    ,coin_sig
-    ,amount_with_fee
-    )
-    VALUES
-    (bdsi
-    ,ini_coin_pub
-    ,ini_coin_sig
-    ,ini_amount_with_fee
-    )
-    ON CONFLICT DO NOTHING;
-
-  IF FOUND
-  THEN
-    -- Insert did happen, update balance in known_coins!
-
-    UPDATE known_coins kc
-      SET
-        remaining.frac=(kc.remaining).frac-ini_amount_with_fee.frac
-          + CASE
-              WHEN (kc.remaining).frac < ini_amount_with_fee.frac
-              THEN 100000000
-              ELSE 0
-            END,
-        remaining.val=(kc.remaining).val-ini_amount_with_fee.val
-          - CASE
-              WHEN (kc.remaining).frac < ini_amount_with_fee.frac
-              THEN 1
-              ELSE 0
-            END
-      WHERE coin_pub=ini_coin_pub
-        AND ( ((kc.remaining).val > ini_amount_with_fee.val) OR
-              ( ((kc.remaining).frac >= ini_amount_with_fee.frac) AND
-                ((kc.remaining).val >= ini_amount_with_fee.val) ) );
-
-    IF NOT FOUND
-    THEN
-      -- Insufficient balance.
-      -- Note: C arrays are 0 indexed, but i started at 1
-      out_insufficient_balance_coin_index=i-1;
-      RETURN;
-    END IF;
-  END IF;
-END LOOP; -- end FOR all coins
-
-END $$;
diff --git a/src/donaudb/donau_do_reserves_in_insert.sql 
b/src/donaudb/donau_do_reserves_in_insert.sql
deleted file mode 100644
index 7ae7a31..0000000
--- a/src/donaudb/donau_do_reserves_in_insert.sql
+++ /dev/null
@@ -1,123 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2023 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-
-CREATE OR REPLACE FUNCTION donau_do_array_reserves_insert(
-  IN in_gc_date INT8,
-  IN in_reserve_expiration INT8,
-  IN ina_reserve_pub BYTEA[],
-  IN ina_wire_ref INT8[],
-  IN ina_credit taler_amount[],
-  IN ina_donau_account_name TEXT[],
-  IN ina_execution_date INT8[],
-  IN ina_wire_source_h_payto BYTEA[],
-  IN ina_payto_uri TEXT[],
-  IN ina_notify TEXT[])
-RETURNS SETOF donau_do_array_reserve_insert_return_type
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  curs REFCURSOR;
-  conflict BOOL;
-  dup BOOL;
-  uuid INT8;
-  i INT4;
-  ini_reserve_pub BYTEA;
-  ini_wire_ref INT8;
-  ini_credit taler_amount;
-  ini_donau_account_name TEXT;
-  ini_execution_date INT8;
-  ini_wire_source_h_payto BYTEA;
-  ini_payto_uri TEXT;
-  ini_notify TEXT;
-BEGIN
-
-  FOR i IN 1..array_length(ina_reserve_pub,1)
-  LOOP
-    ini_reserve_pub = ina_reserve_pub[i];
-    ini_wire_ref = ina_wire_ref[i];
-    ini_credit = ina_credit[i];
-    ini_donau_account_name = ina_donau_account_name[i];
-    ini_execution_date = ina_execution_date[i];
-    ini_wire_source_h_payto = ina_wire_source_h_payto[i];
-    ini_payto_uri = ina_payto_uri[i];
-    ini_notify = ina_notify[i];
-
---    RAISE WARNING 'Starting loop on %', ini_notify;
-
-    INSERT INTO wire_targets
-      (wire_target_h_payto
-      ,payto_uri
-      ) VALUES (
-        ini_wire_source_h_payto
-       ,ini_payto_uri
-      )
-    ON CONFLICT DO NOTHING;
-
-    INSERT INTO reserves
-      (reserve_pub
-      ,current_balance
-      ,expiration_date
-      ,gc_date
-    ) VALUES (
-      ini_reserve_pub
-     ,ini_credit
-     ,in_reserve_expiration
-     ,in_gc_date
-    )
-    ON CONFLICT DO NOTHING
-    RETURNING reserve_uuid
-      INTO uuid;
-    conflict = NOT FOUND;
-
-    INSERT INTO reserves_in
-      (reserve_pub
-      ,wire_reference
-      ,credit
-      ,donau_account_section
-      ,wire_source_h_payto
-      ,execution_date
-    ) VALUES (
-      ini_reserve_pub
-     ,ini_wire_ref
-     ,ini_credit
-     ,ini_donau_account_name
-     ,ini_wire_source_h_payto
-     ,ini_execution_date
-    )
-    ON CONFLICT DO NOTHING;
-
-    IF NOT FOUND
-    THEN
-      IF conflict
-      THEN
-        dup = TRUE;
-      else
-        dup = FALSE;
-      END IF;
-    ELSE
-      IF NOT conflict
-      THEN
-        EXECUTE FORMAT (
-          'NOTIFY %s'
-          ,ini_notify);
-      END IF;
-      dup = FALSE;
-    END IF;
-    RETURN NEXT (dup,uuid);
-  END LOOP;
-  RETURN;
-END $$;
diff --git a/src/donaudb/donau_do_withdraw.sql 
b/src/donaudb/donau_do_withdraw.sql
deleted file mode 100644
index cae3908..0000000
--- a/src/donaudb/donau_do_withdraw.sql
+++ /dev/null
@@ -1,213 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-
-CREATE OR REPLACE FUNCTION donau_do_withdraw(
-  IN cs_nonce BYTEA,
-  IN amount taler_amount,
-  IN h_denom_pub BYTEA,
-  IN rpub BYTEA,
-  IN reserve_sig BYTEA,
-  IN h_coin_envelope BYTEA,
-  IN denom_sig BYTEA,
-  IN now INT8,
-  IN min_reserve_gc INT8,
-  IN do_age_check BOOLEAN,
-  OUT reserve_found BOOLEAN,
-  OUT balance_ok BOOLEAN,
-  OUT nonce_ok BOOLEAN,
-  OUT age_ok BOOLEAN,
-  OUT allowed_maximum_age INT2, -- in years
-  OUT ruuid INT8)
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  reserve RECORD;
-  denom_serial INT8;
-  balance taler_amount;
-  not_before date;
-BEGIN
--- Shards: reserves by reserve_pub (SELECT)
---         reserves_out (INSERT, with CONFLICT detection) by wih
---         reserves by reserve_pub (UPDATE)
---         reserves_in by reserve_pub (SELECT)
---         wire_targets by wire_target_h_payto
-
-SELECT denominations_serial
-  INTO denom_serial
-  FROM donau.denominations
- WHERE denom_pub_hash=h_denom_pub;
-
-IF NOT FOUND
-THEN
-  -- denomination unknown, should be impossible!
-  reserve_found=FALSE;
-  balance_ok=FALSE;
-  age_ok=FALSE;
-  allowed_maximum_age=0;
-  ruuid=0;
-  ASSERT false, 'denomination unknown';
-  RETURN;
-END IF;
-
-
-SELECT *
-  INTO reserve
-  FROM donau.reserves
- WHERE reserves.reserve_pub=rpub;
-
-IF NOT FOUND
-THEN
-  -- reserve unknown
-  reserve_found=FALSE;
-  balance_ok=FALSE;
-  nonce_ok=TRUE;
-  age_ok=FALSE;
-  allowed_maximum_age=0;
-  ruuid=2;
-  RETURN;
-END IF;
-
-balance = reserve.current_balance;
-ruuid = reserve.reserve_uuid;
-
--- Check if age requirements are present
-IF ((NOT do_age_check) OR (reserve.birthday = 0))
-THEN
-  age_ok = TRUE;
-  allowed_maximum_age = -1;
-ELSE
-  -- Age requirements are formally not met:  The donau is setup to support
-  -- age restrictions (do_age_check == TRUE) and the reserve has a
-  -- birthday set (reserve_birthday != 0), but the client called the
-  -- batch-withdraw endpoint instead of the age-withdraw endpoint, which it
-  -- should have.
-  not_before=date '1970-01-01' + reserve.birthday;
-  allowed_maximum_age = extract(year from age(current_date, not_before));
-
-  reserve_found=TRUE;
-  nonce_ok=TRUE; -- we do not really know
-  balance_ok=TRUE;-- we do not really know
-  age_ok = FALSE;
-  RETURN;
-END IF;
-
--- We optimistically insert, and then on conflict declare
--- the query successful due to idempotency.
-INSERT INTO donau.reserves_out
-  (h_blind_ev
-  ,denominations_serial
-  ,denom_sig
-  ,reserve_uuid
-  ,reserve_sig
-  ,execution_date
-  ,amount_with_fee)
-VALUES
-  (h_coin_envelope
-  ,denom_serial
-  ,denom_sig
-  ,ruuid
-  ,reserve_sig
-  ,now
-  ,amount)
-ON CONFLICT DO NOTHING;
-
-IF NOT FOUND
-THEN
-  -- idempotent query, all constraints must be satisfied
-  reserve_found=TRUE;
-  balance_ok=TRUE;
-  nonce_ok=TRUE;
-  RETURN;
-END IF;
-
--- Check reserve balance is sufficient.
-IF (balance.val > amount.val)
-THEN
-  IF (balance.frac >= amount.frac)
-  THEN
-    balance.val=balance.val - amount.val;
-    balance.frac=balance.frac - amount.frac;
-  ELSE
-    balance.val=balance.val - amount.val - 1;
-    balance.frac=balance.frac + 100000000 - amount.frac;
-  END IF;
-ELSE
-  IF (balance.val = amount.val) AND (balance.frac >= amount.frac)
-  THEN
-    balance.val=0;
-    balance.frac=balance.frac - amount.frac;
-  ELSE
-    reserve_found=TRUE;
-    nonce_ok=TRUE; -- we do not really know
-    balance_ok=FALSE;
-    RETURN;
-  END IF;
-END IF;
-
--- Calculate new expiration dates.
-min_reserve_gc=GREATEST(min_reserve_gc,reserve.gc_date);
-
--- Update reserve balance.
-UPDATE reserves SET
-  gc_date=min_reserve_gc
- ,current_balance=balance
-WHERE
-  reserves.reserve_pub=rpub;
-
-reserve_found=TRUE;
-balance_ok=TRUE;
-
-
-
--- Special actions needed for a CS withdraw?
-IF NOT NULL cs_nonce
-THEN
-  -- Cache CS signature to prevent replays in the future
-  -- (and check if cached signature exists at the same time).
-  INSERT INTO donau.cs_nonce_locks
-    (nonce
-    ,max_denomination_serial
-    ,op_hash)
-  VALUES
-    (cs_nonce
-    ,denom_serial
-    ,h_coin_envelope)
-  ON CONFLICT DO NOTHING;
-
-  IF NOT FOUND
-  THEN
-    -- See if the existing entry is identical.
-    SELECT 1
-      FROM donau.cs_nonce_locks
-     WHERE nonce=cs_nonce
-       AND op_hash=h_coin_envelope;
-    IF NOT FOUND
-    THEN
-      reserve_found=FALSE;
-      balance_ok=FALSE;
-      nonce_ok=FALSE;
-      RETURN;
-    END IF;
-  END IF;
-ELSE
-  nonce_ok=TRUE; -- no nonce, hence OK!
-END IF;
-
-END $$;
-
-COMMENT ON FUNCTION donau_do_withdraw(BYTEA, taler_amount, BYTEA, BYTEA, 
BYTEA, BYTEA, BYTEA, INT8, INT8, BOOLEAN)
-  IS 'Checks whether the reserve has sufficient balance for a withdraw 
operation (or the request is repeated and was previously approved) and if the 
age requirements are formally met.  If so updates the database with the result';
diff --git a/src/donaudb/pg_activate_signing_key.c 
b/src/donaudb/pg_activate_signing_key.c
index cf7d717..c2919a8 100644
--- a/src/donaudb/pg_activate_signing_key.c
+++ b/src/donaudb/pg_activate_signing_key.c
@@ -16,7 +16,7 @@
 /**
  * @file donaudb/pg_activate_signing_key.c
  * @brief Implementation of the activate_signing_key function for Postgres
- * @author Christian Grothoff
+ * @author Johannes Casaburi
  */
 #include "platform.h"
 #include "taler_error_codes.h"
@@ -37,7 +37,6 @@ TEH_PG_activate_signing_key (
     GNUNET_PQ_query_param_timestamp (&meta->start),
     GNUNET_PQ_query_param_timestamp (&meta->expire_sign),
     GNUNET_PQ_query_param_timestamp (&meta->expire_legal),
-    GNUNET_PQ_query_param_auto_from_type (master_sig),
     GNUNET_PQ_query_param_end
   };
 
diff --git a/src/donaudb/pg_add_donation_unit_key.c 
b/src/donaudb/pg_add_donation_unit_key.c
index 0453a07..ae122b1 100644
--- a/src/donaudb/pg_add_donation_unit_key.c
+++ b/src/donaudb/pg_add_donation_unit_key.c
@@ -14,73 +14,43 @@
    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 /**
- * @file donaudb/pg_add_denomination_key.c
- * @brief Implementation of the add_denomination_key function for Postgres
- * @author Christian Grothoff
+ * @file donaudb/pg_add_donation_unit_key.c
+ * @brief Implementation of the add_donation_unit_key function for Postgres
+ * @author Johannes Casaburi
  */
 #include "platform.h"
 #include "taler_error_codes.h"
 #include "taler_dbevents.h"
 #include "taler_pq_lib.h"
-#include "pg_add_denomination_key.h"
+#include "pg_add_donation_unit_key.h"
 #include "pg_helper.h"
 
 
 enum GNUNET_DB_QueryStatus
-TEH_PG_add_denomination_key (
+TEH_PG_add_donation_unit_key (
   void *cls,
-  const struct TALER_DenominationHashP *h_denom_pub,
-  const struct TALER_DenominationPublicKey *denom_pub,
-  const struct TALER_DONAUDB_DenominationKeyMetaData *meta,
-  const struct TALER_MasterSignatureP *master_sig)
+  const struct TALER_DonationUnitPublicKey *donation_unit_pub,
+  const struct TALER_DONAUDB_DonationUnitKeyMetaData *meta)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam iparams[] = {
-    GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
-    TALER_PQ_query_param_denom_pub (denom_pub),
-    GNUNET_PQ_query_param_auto_from_type (master_sig),
-    GNUNET_PQ_query_param_timestamp (&meta->start),
-    GNUNET_PQ_query_param_timestamp (&meta->expire_withdraw),
-    GNUNET_PQ_query_param_timestamp (&meta->expire_deposit),
-    GNUNET_PQ_query_param_timestamp (&meta->expire_legal),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &meta->value),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &meta->fees.withdraw),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &meta->fees.deposit),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &meta->fees.refresh),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &meta->fees.refund),
-    GNUNET_PQ_query_param_uint32 (&meta->age_mask.bits),
+    GNUNET_PQ_query_param_auto_from_type (&meta->donation_unit_pub_hash),
+    TALER_PQ_query_param_donation_unit_pub (donation_unit_pub),
+    GNUNET_PQ_query_param_uint64 (&meta->validity_year),
+    TALER_PQ_query_param_amount (&meta->value),
     GNUNET_PQ_query_param_end
   };
 
-  /* Sanity check: ensure fees match coin currency */
-  GNUNET_assert (GNUNET_YES ==
-                 TALER_denom_fee_check_currency (meta->value.currency,
-                                                 &meta->fees));
   PREPARE (pg,
-           "denomination_insert",
-           "INSERT INTO denominations "
-           "(denom_pub_hash"
-           ",denom_pub"
-           ",master_sig"
-           ",valid_from"
-           ",expire_withdraw"
-           ",expire_deposit"
-           ",expire_legal"
-           ",coin"     /* value of this denom */
-           ",fee_withdraw"
-           ",fee_deposit"
-           ",fee_refresh"
-           ",fee_refund"
-           ",age_mask"
+           "donation_unit_insert",
+           "INSERT INTO donation_units "
+           "(donation_unit_pub_hash"
+           ",donation_unit_pub"
+           ",validity_year"
+           ",taler_amount"
            ") VALUES "
-           "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
-           " $11, $12, $13);");
+           "($1, $2, $3, $4);");
   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             "denomination_insert",
+                                             "donation_unit_insert",
                                              iparams);
 }
diff --git a/src/donaudb/pg_add_donation_unit_key.h 
b/src/donaudb/pg_add_donation_unit_key.h
index 90c971d..8cde55b 100644
--- a/src/donaudb/pg_add_donation_unit_key.h
+++ b/src/donaudb/pg_add_donation_unit_key.h
@@ -31,12 +31,12 @@
  *
  * @param cls closure
  * @param denom_pub the actual denomination key
- * @param info information about the donation unit key
+ * @param meta meta information about the donation unit key
  * @return transaction status code
  */
 enum GNUNET_DB_QueryStatus
 TEH_PG_add_donation_unit_key (
   void *cls,
   const struct TALER_DenominationPublicKey *denom_pub,
-  const struct TALER_DONAUDB_DenominationKeyInformation *info)
+  const struct TALER_DONAUDB_DenominationKeyMetaInfo *meta)
 #endif
diff --git a/src/donaudb/pg_count_known_coins.h 
b/src/donaudb/pg_count_known_coins.h
deleted file mode 100644
index f5469b7..0000000
--- a/src/donaudb/pg_count_known_coins.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-   This file is part of TALER
-   Copyright (C) 2022 Taler Systems SA
-
-   TALER is free software; you can redistribute it and/or modify it under the
-   terms of the GNU General Public License as published by the Free Software
-   Foundation; either version 3, or (at your option) any later version.
-
-   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
-   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along with
-   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-/**
- * @file donaudb/pg_count_known_coins.h
- * @brief implementation of the count_known_coins function for Postgres
- * @author Christian Grothoff
- */
-#ifndef PG_COUNT_KNOWN_COINS_H
-#define PG_COUNT_KNOWN_COINS_H
-
-#include "taler_util.h"
-#include "taler_json_lib.h"
-#include "taler_donaudb_plugin.h"
-/**
- * Count the number of known coins by denomination.
- *
- * @param cls database connection plugin state
- * @param denom_pub_hash denomination to count by
- * @return number of coins if non-negative, otherwise an `enum 
GNUNET_DB_QueryStatus`
- */
-long long
-TEH_PG_count_known_coins (void *cls,
-                          const struct
-                          TALER_DenominationHashP *denom_pub_hash);
-
-#endif
diff --git a/src/donaudb/pg_get_denomination_info.c 
b/src/donaudb/pg_get_denomination_info.c
deleted file mode 100644
index 289638a..0000000
--- a/src/donaudb/pg_get_denomination_info.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-   This file is part of TALER
-   Copyright (C) 2022 Taler Systems SA
-
-   TALER is free software; you can redistribute it and/or modify it under the
-   terms of the GNU General Public License as published by the Free Software
-   Foundation; either version 3, or (at your option) any later version.
-
-   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
-   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along with
-   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-/**
- * @file donaudb/pg_get_denomination_info.c
- * @brief Implementation of the get_denomination_info function for Postgres
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_error_codes.h"
-#include "taler_dbevents.h"
-#include "taler_pq_lib.h"
-#include "pg_get_denomination_info.h"
-#include "pg_helper.h"
-
-
-enum GNUNET_DB_QueryStatus
-TEH_PG_get_denomination_info (
-  void *cls,
-  const struct TALER_DenominationHashP *denom_pub_hash,
-  struct TALER_DONAUDB_DenominationKeyInformation *issue)
-{
-  struct PostgresClosure *pg = cls;
-  enum GNUNET_DB_QueryStatus qs;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
-    GNUNET_PQ_query_param_end
-  };
-  struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_auto_from_type ("master_sig",
-                                          &issue->signature),
-    GNUNET_PQ_result_spec_timestamp ("valid_from",
-                                     &issue->start),
-    GNUNET_PQ_result_spec_timestamp ("expire_withdraw",
-                                     &issue->expire_withdraw),
-    GNUNET_PQ_result_spec_timestamp ("expire_deposit",
-                                     &issue->expire_deposit),
-    GNUNET_PQ_result_spec_timestamp ("expire_legal",
-                                     &issue->expire_legal),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("coin",
-                                 &issue->value),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("fee_withdraw",
-                                 &issue->fees.withdraw),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
-                                 &issue->fees.deposit),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh",
-                                 &issue->fees.refresh),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refund",
-                                 &issue->fees.refund),
-    GNUNET_PQ_result_spec_uint32 ("age_mask",
-                                  &issue->age_mask.bits),
-    GNUNET_PQ_result_spec_end
-  };
-
-  PREPARE (pg,
-           "denomination_get",
-           "SELECT"
-           " master_sig"
-           ",valid_from"
-           ",expire_withdraw"
-           ",expire_deposit"
-           ",expire_legal"
-           ",coin"  /* value of this denom */
-           ",fee_withdraw"
-           ",fee_deposit"
-           ",fee_refresh"
-           ",fee_refund"
-           ",age_mask"
-           " FROM denominations"
-           " WHERE denom_pub_hash=$1;");
-  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                 "denomination_get",
-                                                 params,
-                                                 rs);
-  if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
-    return qs;
-  issue->denom_hash = *denom_pub_hash;
-  return qs;
-}
diff --git a/src/donaudb/pg_count_known_coins.c 
b/src/donaudb/pg_get_donation_unit_info.c
similarity index 55%
rename from src/donaudb/pg_count_known_coins.c
rename to src/donaudb/pg_get_donation_unit_info.c
index 98e76b0..700a065 100644
--- a/src/donaudb/pg_count_known_coins.c
+++ b/src/donaudb/pg_get_donation_unit_info.c
@@ -14,50 +14,54 @@
    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 /**
- * @file donaudb/pg_count_known_coins.c
- * @brief Implementation of the count_known_coins function for Postgres
+ * @file donaudb/pg_get_denomination_info.c
+ * @brief Implementation of the get_denomination_info function for Postgres
  * @author Christian Grothoff
  */
 #include "platform.h"
 #include "taler_error_codes.h"
 #include "taler_dbevents.h"
 #include "taler_pq_lib.h"
-#include "pg_count_known_coins.h"
+#include "pg_get_donation_unit_info.h"
 #include "pg_helper.h"
 
-long long
-TEH_PG_count_known_coins (void *cls,
-                          const struct
-                          TALER_DenominationHashP *denom_pub_hash)
+
+enum GNUNET_DB_QueryStatus
+TEH_PG_get_donation_unit_info (
+  void *cls,
+  const struct TALER_DonationUnitHashP *donation_unit_pub_hash,
+  struct TALER_DONAUDB_DenominationKeyMetaData *meta)
 {
   struct PostgresClosure *pg = cls;
-  uint64_t count;
+  enum GNUNET_DB_QueryStatus qs;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (denom_pub_hash),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_uint64 ("count",
-                                  &count),
+    GNUNET_PQ_result_spec_auto_from_type ("donation_unit_pub",
+                                          &meta->donation_unit_pub),
+    TALER_PQ_RESULT_SPEC_AMOUNT ("value",
+                                 &meta->donation_unit),
+    GNUNET_PQ_result_spec_uint32 ("validity_year",
+                                  &meta->validity_year),
     GNUNET_PQ_result_spec_end
   };
-  enum GNUNET_DB_QueryStatus qs;
-
 
   PREPARE (pg,
-           "count_known_coins",
+           "donation_unit_get",
            "SELECT"
-           " COUNT(*) AS count"
-           " FROM known_coins"
-           " WHERE denominations_serial="
-           "  (SELECT denominations_serial"
-           "    FROM denominations"
-           "    WHERE denom_pub_hash=$1);");
+           ",donation_unit_pub"
+           ",validity_year"
+           ",value"
+           " FROM denominations"
+           " WHERE denom_pub_hash=$1;");
   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                 "count_known_coins",
+                                                 "donation_unit_get",
                                                  params,
                                                  rs);
-  if (0 > qs)
-    return (long long) qs;
-  return (long long) count;
+  if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
+    return qs;
+  meta->donation_unit_hash = *donation_unit_pub_hash;
+  return qs;
 }
diff --git a/src/donaudb/pg_get_denomination_info.h 
b/src/donaudb/pg_get_donation_unit_info.h
similarity index 96%
rename from src/donaudb/pg_get_denomination_info.h
rename to src/donaudb/pg_get_donation_unit_info.h
index 7b5b0d7..ab53f39 100644
--- a/src/donaudb/pg_get_denomination_info.h
+++ b/src/donaudb/pg_get_donation_unit_info.h
@@ -36,6 +36,6 @@ enum GNUNET_DB_QueryStatus
 TEH_PG_get_donation_unit_info (
   void *cls,
   const struct TALER_DonationUNitHashP *donation_unit_pub_hash,
-  struct TALER_DONAUDB_DonationUnitKeyInformation *info);
+  struct TALER_DONAUDB_DonationUnitKeyMetaData *meta);
 
 #endif
diff --git a/src/donaudb/pg_insert_charity.c b/src/donaudb/pg_insert_charity.c
new file mode 100644
index 0000000..883acac
--- /dev/null
+++ b/src/donaudb/pg_insert_charity.c
@@ -0,0 +1,60 @@
+/*
+   This file is part of TALER
+   Copyright (C) 2023 Taler Systems SA
+
+   TALER is free software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the Free Software
+   Foundation; either version 3, or (at your option) any later version.
+
+   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along with
+   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_insert_charity.c
+ * @brief Implementation of the insert_charity function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "taler_error_codes.h"
+#include "taler_dbevents.h"
+#include "taler_pq_lib.h"
+#include "pg_insert_charity.h"
+#include "pg_helper.h"
+
+enum GNUNET_DB_QueryStatus
+TEH_PG_insert_charity (void *cls,
+                       const struct TALER_CharityPublicKeyP *charity_pub,
+                       const char *charity_url,
+                       const char *charity_name,
+                       uint64_t current_year,
+                       struct TALER_Amount *receipts_to_date)
+{
+  struct PostgresClosure *pg = cls;
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_auto_from_type (charity_pub),
+    GNUNET_PQ_query_param_string (charity_name),
+    GNUNET_PQ_query_param_string (charity_url),
+    GNUNET_PQ_query_param_uint64 (current_year),
+    TALER_PQ_query_param_amount (receipts_to_date),
+    GNUNET_PQ_query_param_end
+  };
+
+  /* used in #postgres_insert_charity() */
+  PREPARE (pg,
+           "insert_charity",
+           "INSERT INTO charities "
+           "(charity_pub"
+           ",charity_name"
+           ",charity_url"
+           ",current_year"
+           ",receipts_to_date"
+           ") VALUES "
+           "($1, $2, $3, $4, $5);");
+  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+                                             "insert_charity",
+                                             params);
+}
diff --git a/src/donaudb/pg_insert_denomination_info.h 
b/src/donaudb/pg_insert_charity.h
similarity index 55%
rename from src/donaudb/pg_insert_denomination_info.h
rename to src/donaudb/pg_insert_charity.h
index 059758c..416da92 100644
--- a/src/donaudb/pg_insert_denomination_info.h
+++ b/src/donaudb/pg_insert_charity.h
@@ -14,28 +14,32 @@
    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 /**
- * @file donaudb/pg_insert_denomination_info.h
- * @brief implementation of the insert_denomination_info function for Postgres
+ * @file donaudb/pg_insert_charity.h
+ * @brief implementation of the add_denomination_key function for Postgres
  * @author Johannes Casaburi
  */
-#ifndef PG_INSERT_DONATION_UNIT_INFO_H
-#define PG_INSERT_DONATION_UNIT_INFO_H
+#ifndef PG_INSERT_CHARITY_H
+#define PG_INSERT_CHARITY_H
 
 #include "taler_util.h"
 #include "taler_json_lib.h"
 #include "taler_donaudb_plugin.h"
+
 /**
- * Insert a donation unit key's public information into the database
+ * Activate donation unit key, turning it into a "current" or "valid"
+ * denomination key by adding the master signature.
  *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param donation_unit_pub the public key used for signing coins of this 
denomination
- * @param info information with value, fees and other info about the coin
- * @return status of the query
+ * @param cls closure
+ * @param denom_pub the actual denomination key
+ * @param meta meta information about the donation unit key
+ * @return transaction status code
  */
 enum GNUNET_DB_QueryStatus
-TEH_PG_insert_denomination_info (
+TEH_PG_insert_charity (
   void *cls,
-  const struct TALER_DonationUnitPublicKey *donation_unit_pub,
-  const struct TALER_DONAUDB_DonationUnitKeyInformation *info);
-
+  const struct TALER_CharityPublicKey *charity_pub,
+  const char *charity_name,
+  const char *charity_url,
+  struct TALER_Amount *receipts_to_date,
+  uint64_t current_year);
 #endif
diff --git a/src/donaudb/pg_insert_denomination_info.c 
b/src/donaudb/pg_insert_denomination_info.c
deleted file mode 100644
index 97764cc..0000000
--- a/src/donaudb/pg_insert_denomination_info.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-   This file is part of TALER
-   Copyright (C) 2022 Taler Systems SA
-
-   TALER is free software; you can redistribute it and/or modify it under the
-   terms of the GNU General Public License as published by the Free Software
-   Foundation; either version 3, or (at your option) any later version.
-
-   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
-   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along with
-   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-/**
- * @file donaudb/pg_insert_denomination_info.c
- * @brief Implementation of the insert_denomination_info function for Postgres
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_error_codes.h"
-#include "taler_dbevents.h"
-#include "taler_pq_lib.h"
-#include "pg_insert_denomination_info.h"
-#include "pg_helper.h"
-
-
-enum GNUNET_DB_QueryStatus
-TEH_PG_insert_denomination_info (
-  void *cls,
-  const struct TALER_DenominationPublicKey *denom_pub,
-  const struct TALER_DONAUDB_DenominationKeyInformation *issue)
-{
-  struct PostgresClosure *pg = cls;
-  struct TALER_DenominationHashP denom_hash;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (&issue->denom_hash),
-    TALER_PQ_query_param_denom_pub (denom_pub),
-    GNUNET_PQ_query_param_auto_from_type (&issue->signature),
-    GNUNET_PQ_query_param_timestamp (&issue->start),
-    GNUNET_PQ_query_param_timestamp (&issue->expire_withdraw),
-    GNUNET_PQ_query_param_timestamp (&issue->expire_deposit),
-    GNUNET_PQ_query_param_timestamp (&issue->expire_legal),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &issue->value),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &issue->fees.withdraw),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &issue->fees.deposit),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &issue->fees.refresh),
-    TALER_PQ_query_param_amount (pg->conn,
-                                 &issue->fees.refund),
-    GNUNET_PQ_query_param_uint32 (&denom_pub->age_mask.bits),
-    GNUNET_PQ_query_param_end
-  };
-
-  GNUNET_assert (denom_pub->age_mask.bits ==
-                 issue->age_mask.bits);
-  TALER_denom_pub_hash (denom_pub,
-                        &denom_hash);
-  GNUNET_assert (0 ==
-                 GNUNET_memcmp (&denom_hash,
-                                &issue->denom_hash));
-  GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
-                   issue->start.abs_time));
-  GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
-                   issue->expire_withdraw.abs_time));
-  GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
-                   issue->expire_deposit.abs_time));
-  GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
-                   issue->expire_legal.abs_time));
-  /* check fees match denomination currency */
-  GNUNET_assert (GNUNET_YES ==
-                 TALER_denom_fee_check_currency (
-                   issue->value.currency,
-                   &issue->fees));
-  PREPARE (pg,
-           "denomination_insert",
-           "INSERT INTO denominations "
-           "(denom_pub_hash"
-           ",denom_pub"
-           ",master_sig"
-           ",valid_from"
-           ",expire_withdraw"
-           ",expire_deposit"
-           ",expire_legal"
-           ",coin"  /* value of this denom */
-           ",fee_withdraw"
-           ",fee_deposit"
-           ",fee_refresh"
-           ",fee_refund"
-           ",age_mask"
-           ") VALUES "
-           "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
-           " $11, $12, $13);");
-  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             "denomination_insert",
-                                             params);
-}
diff --git a/src/include/taler_donaudb_plugin.h 
b/src/include/taler_donaudb_plugin.h
index 21e97a0..d3b8398 100644
--- a/src/include/taler_donaudb_plugin.h
+++ b/src/include/taler_donaudb_plugin.h
@@ -28,9 +28,9 @@
 #include "taler_extensions_policy.h"
 
 /**
- * Information about a donation unit key.
+ * Meta data about a donation unit key.
  */
-struct TALER_DONAUDB_DonationUnitKeyInformation
+struct TALER_DONAUDB_DonationUnitKeyMetaData
 {
   /**
    * The value of the donation unit.
@@ -49,7 +49,6 @@ struct TALER_DONAUDB_DonationUnitKeyInformation
 
 };
 
-
 /**
  * Meta data about an donau signing key.
  */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]