exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

lookup_records_by_table.h (19436B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2022 Taler Systems SA
      4 
      5    TALER is free software; you can redistribute it and/or modify it under the
      6    terms of the GNU General Public License as published by the Free Software
      7    Foundation; either version 3, or (at your option) any later version.
      8 
      9    TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11    A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 
     13    You should have received a copy of the GNU General Public License along with
     14    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 /**
     17  * @file lookup_records_by_table.h
     18  * @brief implementation of the lookup_records_by_table function
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_LOOKUP_RECORDS_BY_TABLE_H
     22 #define EXCHANGE_DATABASE_LOOKUP_RECORDS_BY_TABLE_H
     23 
     24 #include "taler/taler_json_lib.h"
     25 #include "exchangedb_lib.h"
     26 
     27 
     28 /**
     29  * Enumeration of all of the tables replicated by exchange-auditor
     30  * database replication.
     31  *
     32  * Note: wire_accounts is not replicated. So far not needed by the auditor.
     33  */
     34 enum TALER_EXCHANGEDB_ReplicatedTable
     35 {
     36   TALER_EXCHANGEDB_RT_DENOMINATIONS,
     37   TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS,
     38   TALER_EXCHANGEDB_RT_KYC_TARGETS,
     39   TALER_EXCHANGEDB_RT_WIRE_TARGETS,
     40   TALER_EXCHANGEDB_RT_RESERVES,
     41   TALER_EXCHANGEDB_RT_RESERVES_IN,
     42   TALER_EXCHANGEDB_RT_RESERVES_CLOSE,
     43   TALER_EXCHANGEDB_RT_RESERVES_OPEN_REQUESTS,
     44   TALER_EXCHANGEDB_RT_RESERVES_OPEN_DEPOSITS,
     45   TALER_EXCHANGEDB_RT_AUDITORS,
     46   TALER_EXCHANGEDB_RT_AUDITOR_DENOM_SIGS,
     47   TALER_EXCHANGEDB_RT_EXCHANGE_SIGN_KEYS,
     48   TALER_EXCHANGEDB_RT_SIGNKEY_REVOCATIONS,
     49   TALER_EXCHANGEDB_RT_KNOWN_COINS,
     50   TALER_EXCHANGEDB_RT_REFRESH,
     51   TALER_EXCHANGEDB_RT_BATCH_DEPOSITS,
     52   TALER_EXCHANGEDB_RT_COIN_DEPOSITS,
     53   TALER_EXCHANGEDB_RT_REFUNDS,
     54   TALER_EXCHANGEDB_RT_WIRE_OUT,
     55   TALER_EXCHANGEDB_RT_AGGREGATION_TRACKING,
     56   TALER_EXCHANGEDB_RT_WIRE_FEE,
     57   TALER_EXCHANGEDB_RT_GLOBAL_FEE,
     58   TALER_EXCHANGEDB_RT_RECOUP,
     59   TALER_EXCHANGEDB_RT_RECOUP_REFRESH,
     60   TALER_EXCHANGEDB_RT_EXTENSIONS,
     61   TALER_EXCHANGEDB_RT_POLICY_DETAILS,
     62   TALER_EXCHANGEDB_RT_POLICY_FULFILLMENTS,
     63   TALER_EXCHANGEDB_RT_PURSE_REQUESTS,
     64   TALER_EXCHANGEDB_RT_PURSE_DECISION,
     65   TALER_EXCHANGEDB_RT_PURSE_MERGES,
     66   TALER_EXCHANGEDB_RT_PURSE_DEPOSITS,
     67   TALER_EXCHANGEDB_RT_ACCOUNT_MERGES,
     68   TALER_EXCHANGEDB_RT_HISTORY_REQUESTS,
     69   TALER_EXCHANGEDB_RT_CLOSE_REQUESTS,
     70   TALER_EXCHANGEDB_RT_WADS_OUT,
     71   TALER_EXCHANGEDB_RT_WADS_OUT_ENTRIES,
     72   TALER_EXCHANGEDB_RT_WADS_IN,
     73   TALER_EXCHANGEDB_RT_WADS_IN_ENTRIES,
     74   TALER_EXCHANGEDB_RT_PROFIT_DRAINS,
     75   TALER_EXCHANGEDB_RT_AML_STAFF,
     76   TALER_EXCHANGEDB_RT_PURSE_DELETION,
     77   TALER_EXCHANGEDB_RT_WITHDRAW,
     78   TALER_EXCHANGEDB_RT_LEGITIMIZATION_MEASURES,
     79   TALER_EXCHANGEDB_RT_LEGITIMIZATION_OUTCOMES,
     80   TALER_EXCHANGEDB_RT_LEGITIMIZATION_PROCESSES,
     81   TALER_EXCHANGEDB_RT_KYC_ATTRIBUTES,
     82   TALER_EXCHANGEDB_RT_AML_HISTORY,
     83   TALER_EXCHANGEDB_RT_KYC_EVENTS,
     84   TALER_EXCHANGEDB_RT_KYCAUTHS_IN
     85 };
     86 
     87 
     88 /**
     89  * Record of a single entry in a replicated table.
     90  */
     91 struct TALER_EXCHANGEDB_TableData
     92 {
     93   /**
     94    * Data of which table is returned here?
     95    */
     96   enum TALER_EXCHANGEDB_ReplicatedTable table;
     97 
     98   /**
     99    * Serial number of the record.
    100    */
    101   uint64_t serial;
    102 
    103   /**
    104    * Table-specific details.
    105    */
    106   union
    107   {
    108 
    109     /**
    110      * Details from the 'denominations' table.
    111      */
    112     struct
    113     {
    114       uint32_t denom_type;
    115       uint32_t age_mask;
    116       struct TALER_DenominationPublicKey denom_pub;
    117       struct TALER_MasterSignatureP master_sig;
    118       struct GNUNET_TIME_Timestamp valid_from;
    119       struct GNUNET_TIME_Timestamp expire_withdraw;
    120       struct GNUNET_TIME_Timestamp expire_deposit;
    121       struct GNUNET_TIME_Timestamp expire_legal;
    122       struct TALER_Amount coin;
    123       struct TALER_DenomFeeSet fees;
    124     } denominations;
    125 
    126     struct
    127     {
    128       struct TALER_MasterSignatureP master_sig;
    129       uint64_t denominations_serial;
    130     } denomination_revocations;
    131 
    132     struct
    133     {
    134       struct TALER_FullPayto full_payto_uri;
    135     } wire_targets;
    136 
    137     struct
    138     {
    139       struct TALER_NormalizedPaytoHashP h_normalized_payto;
    140       struct TALER_AccountAccessTokenP access_token;
    141       union TALER_AccountPublicKeyP target_pub;
    142       bool no_account;
    143       bool is_wallet;
    144     } kyc_targets;
    145 
    146     struct
    147     {
    148       struct TALER_AccountAccessTokenP target_token;
    149       struct GNUNET_TIME_Timestamp start_time;
    150       json_t *measures;
    151       uint32_t display_priority;
    152     } legitimization_measures;
    153 
    154     struct
    155     {
    156       struct TALER_NormalizedPaytoHashP h_payto;
    157       struct GNUNET_TIME_Timestamp decision_time;
    158       struct GNUNET_TIME_Timestamp expiration_time;
    159       json_t *properties;
    160       bool to_investigate;
    161       json_t *new_rules;
    162     } legitimization_outcomes;
    163 
    164     struct
    165     {
    166       struct TALER_NormalizedPaytoHashP h_payto;
    167       struct GNUNET_TIME_Timestamp start_time;
    168       struct GNUNET_TIME_Timestamp expiration_time;
    169       uint64_t legitimization_measure_serial_id;
    170       uint32_t measure_index;
    171       char *provider_name;
    172       char *provider_user_id;
    173       char *provider_legitimization_id;
    174       char *redirect_url;
    175     } legitimization_processes;
    176 
    177     struct
    178     {
    179       struct TALER_NormalizedPaytoHashP h_payto;
    180       uint64_t legitimization_serial;
    181       struct GNUNET_TIME_Timestamp collection_time;
    182       struct GNUNET_TIME_Timestamp expiration_time;
    183       uint64_t trigger_outcome_serial;
    184       void *encrypted_attributes;
    185       size_t encrypted_attributes_size;
    186     } kyc_attributes;
    187 
    188     struct
    189     {
    190       struct TALER_NormalizedPaytoHashP h_payto;
    191       uint64_t outcome_serial_id;
    192       char *justification;
    193       struct TALER_AmlOfficerPublicKeyP decider_pub;
    194       struct TALER_AmlOfficerSignatureP decider_sig;
    195     } aml_history;
    196 
    197     struct
    198     {
    199       struct GNUNET_TIME_Timestamp event_timestamp;
    200       char *event_type;
    201     } kyc_events;
    202 
    203     struct
    204     {
    205       struct TALER_AmlOfficerPublicKeyP decider_pub;
    206       struct TALER_MasterSignatureP master_sig;
    207       char *decider_name;
    208       bool is_active;
    209       bool read_only;
    210       struct GNUNET_TIME_Timestamp last_change;
    211     } aml_staff;
    212 
    213     struct
    214     {
    215       struct TALER_ReservePublicKeyP reserve_pub;
    216       struct GNUNET_TIME_Timestamp expiration_date;
    217       struct GNUNET_TIME_Timestamp gc_date;
    218     } reserves;
    219 
    220     struct
    221     {
    222       uint64_t wire_reference;
    223       struct TALER_Amount credit;
    224       struct TALER_FullPaytoHashP sender_account_h_payto;
    225       char *exchange_account_section;
    226       struct GNUNET_TIME_Timestamp execution_date;
    227       struct TALER_ReservePublicKeyP reserve_pub;
    228     } reserves_in;
    229 
    230     struct
    231     {
    232       uint64_t wire_reference;
    233       struct TALER_Amount credit;
    234       struct TALER_FullPaytoHashP sender_account_h_payto;
    235       char *exchange_account_section;
    236       struct GNUNET_TIME_Timestamp execution_date;
    237       union TALER_AccountPublicKeyP account_pub;
    238     } kycauth_in;
    239 
    240     struct
    241     {
    242       struct TALER_ReservePublicKeyP reserve_pub;
    243       struct GNUNET_TIME_Timestamp request_timestamp;
    244       struct GNUNET_TIME_Timestamp expiration_date;
    245       struct TALER_ReserveSignatureP reserve_sig;
    246       struct TALER_Amount reserve_payment;
    247       uint32_t requested_purse_limit;
    248     } reserves_open_requests;
    249 
    250     struct
    251     {
    252       struct TALER_ReservePublicKeyP reserve_pub;
    253       struct TALER_CoinSpendPublicKeyP coin_pub;
    254       struct TALER_CoinSpendSignatureP coin_sig;
    255       struct TALER_ReserveSignatureP reserve_sig;
    256       struct TALER_Amount contribution;
    257     } reserves_open_deposits;
    258 
    259     struct
    260     {
    261       struct TALER_ReservePublicKeyP reserve_pub;
    262       struct GNUNET_TIME_Timestamp execution_date;
    263       struct TALER_WireTransferIdentifierRawP wtid;
    264       struct TALER_FullPaytoHashP sender_account_h_payto;
    265       struct TALER_Amount amount;
    266       struct TALER_Amount closing_fee;
    267     } reserves_close;
    268 
    269     struct
    270     {
    271       struct TALER_AuditorPublicKeyP auditor_pub;
    272       char *auditor_url;
    273       char *auditor_name;
    274       bool is_active;
    275       struct GNUNET_TIME_Timestamp last_change;
    276     } auditors;
    277 
    278     struct
    279     {
    280       uint64_t auditor_uuid;
    281       uint64_t denominations_serial;
    282       struct TALER_AuditorSignatureP auditor_sig;
    283     } auditor_denom_sigs;
    284 
    285     struct
    286     {
    287       struct TALER_ExchangePublicKeyP exchange_pub;
    288       struct TALER_MasterSignatureP master_sig;
    289       struct TALER_EXCHANGEDB_SignkeyMetaData meta;
    290     } exchange_sign_keys;
    291 
    292     struct
    293     {
    294       uint64_t esk_serial;
    295       struct TALER_MasterSignatureP master_sig;
    296     } signkey_revocations;
    297 
    298     struct
    299     {
    300       struct TALER_CoinSpendPublicKeyP coin_pub;
    301       struct TALER_AgeCommitmentHashP age_hash;
    302       uint64_t denominations_serial;
    303       struct TALER_DenominationSignature denom_sig;
    304     } known_coins;
    305 
    306     struct
    307     {
    308       struct TALER_RefreshCommitmentP rc;
    309       struct GNUNET_TIME_Timestamp execution_date;
    310       struct TALER_Amount amount_with_fee;
    311       struct TALER_CoinSpendPublicKeyP old_coin_pub;
    312       struct TALER_CoinSpendSignatureP old_coin_sig;
    313       struct TALER_PublicRefreshMasterSeedP refresh_seed;
    314       uint32_t noreveal_index;
    315       struct TALER_HashBlindedPlanchetsP planchets_h;
    316       struct TALER_HashBlindedPlanchetsP selected_h;
    317       bool no_blinding_seed;
    318       struct TALER_BlindingMasterSeedP blinding_seed;
    319       size_t num_cs_r_values;
    320       struct GNUNET_CRYPTO_CSPublicRPairP *cs_r_values;
    321       uint64_t cs_r_choices;
    322       size_t num_coins;
    323       uint64_t *denom_serials;
    324       struct TALER_BlindedDenominationSignature *denom_sigs;
    325     } refresh;
    326 
    327     struct
    328     {
    329       uint64_t shard;
    330       struct TALER_MerchantPublicKeyP merchant_pub;
    331       struct GNUNET_TIME_Timestamp wallet_timestamp;
    332       struct GNUNET_TIME_Timestamp exchange_timestamp;
    333       struct GNUNET_TIME_Timestamp refund_deadline;
    334       struct GNUNET_TIME_Timestamp wire_deadline;
    335       struct TALER_PrivateContractHashP h_contract_terms;
    336       bool no_wallet_data_hash;
    337       struct GNUNET_HashCode wallet_data_hash;
    338       struct TALER_WireSaltP wire_salt;
    339       struct TALER_FullPaytoHashP wire_target_h_payto;
    340       bool no_policy_details;
    341       uint64_t policy_details_serial_id;
    342       bool policy_blocked;
    343       struct TALER_Amount total_amount;
    344       struct TALER_Amount total_without_fee;
    345       struct TALER_MerchantSignatureP merchant_sig;
    346       bool done;
    347     } batch_deposits;
    348 
    349     struct
    350     {
    351       uint64_t batch_deposit_serial_id;
    352       struct TALER_CoinSpendPublicKeyP coin_pub;
    353       struct TALER_CoinSpendSignatureP coin_sig;
    354       struct TALER_Amount amount_with_fee;
    355     } coin_deposits;
    356 
    357     struct
    358     {
    359       struct TALER_CoinSpendPublicKeyP coin_pub;
    360       uint64_t batch_deposit_serial_id;
    361       struct TALER_MerchantSignatureP merchant_sig;
    362       uint64_t rtransaction_id;
    363       struct TALER_Amount amount_with_fee;
    364     } refunds;
    365 
    366     struct
    367     {
    368       struct GNUNET_TIME_Timestamp execution_date;
    369       struct TALER_WireTransferIdentifierRawP wtid_raw;
    370       struct TALER_FullPaytoHashP wire_target_h_payto;
    371       char *exchange_account_section;
    372       struct TALER_Amount amount;
    373     } wire_out;
    374 
    375     struct
    376     {
    377       uint64_t batch_deposit_serial_id;
    378       struct TALER_WireTransferIdentifierRawP wtid_raw;
    379     } aggregation_tracking;
    380 
    381     struct
    382     {
    383       char *wire_method;
    384       struct GNUNET_TIME_Timestamp start_date;
    385       struct GNUNET_TIME_Timestamp end_date;
    386       struct TALER_WireFeeSet fees;
    387       struct TALER_MasterSignatureP master_sig;
    388     } wire_fee;
    389 
    390     struct
    391     {
    392       struct GNUNET_TIME_Timestamp start_date;
    393       struct GNUNET_TIME_Timestamp end_date;
    394       struct TALER_GlobalFeeSet fees;
    395       struct GNUNET_TIME_Relative purse_timeout;
    396       struct GNUNET_TIME_Relative history_expiration;
    397       uint32_t purse_account_limit;
    398       struct TALER_MasterSignatureP master_sig;
    399     } global_fee;
    400 
    401     struct
    402     {
    403       struct TALER_CoinSpendPublicKeyP coin_pub;
    404       struct TALER_CoinSpendSignatureP coin_sig;
    405       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    406       struct TALER_Amount amount;
    407       struct GNUNET_TIME_Timestamp timestamp;
    408       uint64_t withdraw_serial_id;
    409     } recoup;
    410 
    411     struct
    412     {
    413       uint64_t known_coin_id;
    414       struct TALER_CoinSpendPublicKeyP coin_pub;
    415       struct TALER_CoinSpendSignatureP coin_sig;
    416       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    417       struct TALER_Amount amount;
    418       struct GNUNET_TIME_Timestamp timestamp;
    419       uint64_t rrc_serial;
    420     } recoup_refresh;
    421 
    422     struct
    423     {
    424       char *name;
    425       char *manifest;
    426     } extensions;
    427 
    428     struct
    429     {
    430       struct GNUNET_HashCode hash_code;
    431       json_t *policy_json;
    432       bool no_policy_json;
    433       struct GNUNET_TIME_Timestamp deadline;
    434       struct TALER_Amount commitment;
    435       struct TALER_Amount accumulated_total;
    436       struct TALER_Amount fee;
    437       struct TALER_Amount transferable;
    438       uint16_t fulfillment_state; /* will also be recomputed */
    439       uint64_t fulfillment_id;
    440       bool no_fulfillment_id;
    441     } policy_details;
    442 
    443     struct
    444     {
    445       struct GNUNET_TIME_Timestamp fulfillment_timestamp;
    446       char *fulfillment_proof;
    447       struct GNUNET_HashCode h_fulfillment_proof;
    448       struct GNUNET_HashCode *policy_hash_codes;
    449       size_t policy_hash_codes_count;
    450     } policy_fulfillments;
    451 
    452     struct
    453     {
    454       struct TALER_PurseContractPublicKeyP purse_pub;
    455       struct TALER_PurseMergePublicKeyP merge_pub;
    456       struct GNUNET_TIME_Timestamp purse_creation;
    457       struct GNUNET_TIME_Timestamp purse_expiration;
    458       struct TALER_PrivateContractHashP h_contract_terms;
    459       uint32_t age_limit;
    460       uint32_t flags;
    461       struct TALER_Amount amount_with_fee;
    462       struct TALER_Amount purse_fee;
    463       struct TALER_PurseContractSignatureP purse_sig;
    464     } purse_requests;
    465 
    466     struct
    467     {
    468       struct TALER_PurseContractPublicKeyP purse_pub;
    469       struct GNUNET_TIME_Timestamp action_timestamp;
    470       bool refunded;
    471     } purse_decision;
    472 
    473     struct
    474     {
    475       uint64_t partner_serial_id;
    476       struct TALER_ReservePublicKeyP reserve_pub;
    477       struct TALER_PurseContractPublicKeyP purse_pub;
    478       struct TALER_PurseMergeSignatureP merge_sig;
    479       struct GNUNET_TIME_Timestamp merge_timestamp;
    480     } purse_merges;
    481 
    482     struct
    483     {
    484       uint64_t partner_serial_id;
    485       struct TALER_PurseContractPublicKeyP purse_pub;
    486       struct TALER_CoinSpendPublicKeyP coin_pub;
    487       struct TALER_Amount amount_with_fee;
    488       struct TALER_CoinSpendSignatureP coin_sig;
    489     } purse_deposits;
    490 
    491     struct
    492     {
    493       struct TALER_ReservePublicKeyP reserve_pub;
    494       struct TALER_ReserveSignatureP reserve_sig;
    495       struct TALER_PurseContractPublicKeyP purse_pub;
    496       struct TALER_NormalizedPaytoHashP wallet_h_payto;
    497     } account_merges;
    498 
    499     struct
    500     {
    501       struct TALER_ReservePublicKeyP reserve_pub;
    502       struct TALER_ReserveSignatureP reserve_sig;
    503       struct GNUNET_TIME_Timestamp request_timestamp;
    504       struct TALER_Amount history_fee;
    505     } history_requests;
    506 
    507     struct
    508     {
    509       struct TALER_ReservePublicKeyP reserve_pub;
    510       struct GNUNET_TIME_Timestamp close_timestamp;
    511       struct TALER_ReserveSignatureP reserve_sig;
    512       struct TALER_Amount close;
    513       struct TALER_Amount close_fee;
    514       struct TALER_FullPayto payto_uri;
    515     } close_requests;
    516 
    517     struct
    518     {
    519       struct TALER_WadIdentifierP wad_id;
    520       uint64_t partner_serial_id;
    521       struct TALER_Amount amount;
    522       struct GNUNET_TIME_Timestamp execution_time;
    523     } wads_out;
    524 
    525     struct
    526     {
    527       uint64_t wad_out_serial_id;
    528       struct TALER_ReservePublicKeyP reserve_pub;
    529       struct TALER_PurseContractPublicKeyP purse_pub;
    530       struct TALER_PrivateContractHashP h_contract;
    531       struct GNUNET_TIME_Timestamp purse_expiration;
    532       struct GNUNET_TIME_Timestamp merge_timestamp;
    533       struct TALER_Amount amount_with_fee;
    534       struct TALER_Amount wad_fee;
    535       struct TALER_Amount deposit_fees;
    536       struct TALER_ReserveSignatureP reserve_sig;
    537       struct TALER_PurseContractSignatureP purse_sig;
    538     } wads_out_entries;
    539 
    540     struct
    541     {
    542       struct TALER_WadIdentifierP wad_id;
    543       char *origin_exchange_url;
    544       struct TALER_Amount amount;
    545       struct GNUNET_TIME_Timestamp arrival_time;
    546     } wads_in;
    547 
    548     struct
    549     {
    550       uint64_t wad_in_serial_id;
    551       struct TALER_ReservePublicKeyP reserve_pub;
    552       struct TALER_PurseContractPublicKeyP purse_pub;
    553       struct TALER_PrivateContractHashP h_contract;
    554       struct GNUNET_TIME_Timestamp purse_expiration;
    555       struct GNUNET_TIME_Timestamp merge_timestamp;
    556       struct TALER_Amount amount_with_fee;
    557       struct TALER_Amount wad_fee;
    558       struct TALER_Amount deposit_fees;
    559       struct TALER_ReserveSignatureP reserve_sig;
    560       struct TALER_PurseContractSignatureP purse_sig;
    561     } wads_in_entries;
    562 
    563     struct
    564     {
    565       struct TALER_WireTransferIdentifierRawP wtid;
    566       char *account_section;
    567       struct TALER_FullPayto payto_uri;
    568       struct GNUNET_TIME_Timestamp trigger_date;
    569       struct TALER_Amount amount;
    570       struct TALER_MasterSignatureP master_sig;
    571     } profit_drains;
    572 
    573     struct
    574     {
    575       struct TALER_PurseContractPublicKeyP purse_pub;
    576       struct TALER_PurseContractSignatureP purse_sig;
    577     } purse_deletion;
    578 
    579     struct
    580     {
    581       struct TALER_HashBlindedPlanchetsP planchets_h;
    582       struct GNUNET_TIME_Timestamp execution_date;
    583       struct TALER_Amount amount_with_fee;
    584       struct TALER_ReservePublicKeyP reserve_pub;
    585       struct TALER_ReserveSignatureP reserve_sig;
    586       bool age_proof_required;
    587       uint16_t max_age;
    588       uint16_t noreveal_index;
    589       struct TALER_HashBlindedPlanchetsP selected_h;
    590       bool no_blinding_seed;
    591       struct TALER_BlindingMasterSeedP blinding_seed;
    592       size_t num_cs_r_values;
    593       struct GNUNET_CRYPTO_CSPublicRPairP *cs_r_values;
    594       uint64_t cs_r_choices;
    595       size_t num_coins;
    596       uint64_t *denom_serials;
    597       struct TALER_BlindedDenominationSignature *denom_sigs;
    598     } withdraw;
    599 
    600   } details;
    601 
    602 };
    603 
    604 
    605 /**
    606  * Function called on data to replicate in the auditor's database.
    607  *
    608  * @param cls closure
    609  * @param td record from an exchange table
    610  * @return #GNUNET_OK to continue to iterate,
    611  *         #GNUNET_SYSERR to fail with an error
    612  */
    613 typedef int
    614 (*TALER_EXCHANGEDB_ReplicationCallback)(
    615   void *cls,
    616   const struct TALER_EXCHANGEDB_TableData *td);
    617 
    618 
    619 /**
    620  * Function called on data to replicate in the auditor's database.
    621  *
    622  * @param cls closure
    623  * @param td record from an exchange table
    624  * @return #GNUNET_OK to continue to iterate,
    625  *         #GNUNET_SYSERR to fail with an error
    626  */
    627 typedef int
    628 (*TALER_EXCHANGEDB_ReplicationCallback)(
    629   void *cls,
    630   const struct TALER_EXCHANGEDB_TableData *td);
    631 
    632 
    633 /**
    634  * Lookup records above @a serial number in @a table. Used in
    635  * exchange-auditor database replication.
    636  *
    637  * @param pg the database context
    638  * @param table table for which we should return the serial
    639  * @param serial largest serial number to exclude
    640  * @param cb function to call on the records
    641  * @param cb_cls closure for @a cb
    642  * @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
    643  *         @a table does not have a serial number
    644  */
    645 enum GNUNET_DB_QueryStatus
    646 TALER_EXCHANGEDB_lookup_records_by_table (
    647   struct TALER_EXCHANGEDB_PostgresContext *pg,
    648   enum TALER_EXCHANGEDB_ReplicatedTable table,
    649   uint64_t serial,
    650   TALER_EXCHANGEDB_ReplicationCallback cb,
    651   void *cb_cls);
    652 
    653 
    654 #endif