exchange

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

iterate_records_by_table.h (19962B)


      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 iterate_records_by_table.h
     18  * @brief implementation of the lookup_records_by_table function
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_ITERATE_RECORDS_BY_TABLE_H
     22 #define EXCHANGE_DATABASE_ITERATE_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_AGGREGATION_DEFERRALS,
     57   TALER_EXCHANGEDB_RT_WIRE_FEE,
     58   TALER_EXCHANGEDB_RT_GLOBAL_FEE,
     59   TALER_EXCHANGEDB_RT_RECOUP,
     60   TALER_EXCHANGEDB_RT_RECOUP_REFRESH,
     61   TALER_EXCHANGEDB_RT_PURSE_REQUESTS,
     62   TALER_EXCHANGEDB_RT_PURSE_DECISION,
     63   TALER_EXCHANGEDB_RT_PURSE_MERGES,
     64   TALER_EXCHANGEDB_RT_PURSE_DEPOSITS,
     65   TALER_EXCHANGEDB_RT_ACCOUNT_MERGES,
     66   TALER_EXCHANGEDB_RT_HISTORY_REQUESTS,
     67   TALER_EXCHANGEDB_RT_CLOSE_REQUESTS,
     68   TALER_EXCHANGEDB_RT_WADS_OUT,
     69   TALER_EXCHANGEDB_RT_WADS_OUT_ENTRIES,
     70   TALER_EXCHANGEDB_RT_WADS_IN,
     71   TALER_EXCHANGEDB_RT_WADS_IN_ENTRIES,
     72   TALER_EXCHANGEDB_RT_PROFIT_DRAINS,
     73   TALER_EXCHANGEDB_RT_AML_STAFF,
     74   TALER_EXCHANGEDB_RT_PURSE_DELETION,
     75   TALER_EXCHANGEDB_RT_WITHDRAW,
     76   TALER_EXCHANGEDB_RT_LEGITIMIZATION_MEASURES,
     77   TALER_EXCHANGEDB_RT_LEGITIMIZATION_OUTCOMES,
     78   TALER_EXCHANGEDB_RT_LEGITIMIZATION_PROCESSES,
     79   TALER_EXCHANGEDB_RT_KYC_ATTRIBUTES,
     80   TALER_EXCHANGEDB_RT_AML_HISTORY,
     81   TALER_EXCHANGEDB_RT_KYC_EVENTS,
     82   TALER_EXCHANGEDB_RT_KYCAUTHS_IN
     83 };
     84 
     85 
     86 /**
     87  * Record of a single entry in a replicated table.
     88  */
     89 struct TALER_EXCHANGEDB_TableData
     90 {
     91   /**
     92    * Data of which table is returned here?
     93    */
     94   enum TALER_EXCHANGEDB_ReplicatedTable table;
     95 
     96   /**
     97    * Serial number of the record.
     98    */
     99   uint64_t serial;
    100 
    101   /**
    102    * Table-specific details.
    103    */
    104   union
    105   {
    106 
    107     /**
    108      * Details from the 'denominations' table.
    109      */
    110     struct
    111     {
    112       uint32_t denom_type;
    113       uint32_t age_mask;
    114       struct TALER_DenominationPublicKey denom_pub;
    115       struct TALER_MasterSignatureP master_sig;
    116       struct GNUNET_TIME_Timestamp valid_from;
    117       struct GNUNET_TIME_Timestamp expire_withdraw;
    118       struct GNUNET_TIME_Timestamp expire_deposit;
    119       struct GNUNET_TIME_Timestamp expire_legal;
    120       struct TALER_Amount coin;
    121       struct TALER_DenomFeeSet fees;
    122     } denominations;
    123 
    124     struct
    125     {
    126       struct TALER_MasterSignatureP master_sig;
    127       uint64_t denominations_serial;
    128     } denomination_revocations;
    129 
    130     struct
    131     {
    132       struct TALER_FullPayto full_payto_uri;
    133     } wire_targets;
    134 
    135     struct
    136     {
    137       struct TALER_NormalizedPaytoHashP h_normalized_payto;
    138       struct TALER_AccountAccessTokenP access_token;
    139       union TALER_AccountPublicKeyP target_pub;
    140       bool no_account;
    141       bool is_wallet;
    142     } kyc_targets;
    143 
    144     struct
    145     {
    146       struct TALER_AccountAccessTokenP target_token;
    147       /* absolute, not a timestamp: do_trigger_kyc_rule_for_account.c
    148          writes this column with microsecond precision (whereas
    149          insert_active_legitimization_measure.c rounds to seconds) */
    150       struct GNUNET_TIME_Absolute start_time;
    151       json_t *measures;
    152       uint32_t display_priority;
    153     } legitimization_measures;
    154 
    155     struct
    156     {
    157       struct TALER_NormalizedPaytoHashP h_payto;
    158       struct GNUNET_TIME_Timestamp decision_time;
    159       struct GNUNET_TIME_Timestamp expiration_time;
    160       json_t *properties;
    161       bool to_investigate;
    162       json_t *new_rules;
    163     } legitimization_outcomes;
    164 
    165     struct
    166     {
    167       struct TALER_NormalizedPaytoHashP h_payto;
    168       /* absolute, not a timestamp: the exchange stores this column with
    169          microsecond precision (see insert_legitimization_process.c) */
    170       struct GNUNET_TIME_Absolute start_time;
    171       struct GNUNET_TIME_Timestamp expiration_time;
    172       uint64_t legitimization_measure_serial_id;
    173       uint32_t measure_index;
    174       char *provider_name;
    175       char *provider_user_id;
    176       char *provider_legitimization_id;
    177       char *redirect_url;
    178     } legitimization_processes;
    179 
    180     struct
    181     {
    182       struct TALER_NormalizedPaytoHashP h_payto;
    183       uint64_t legitimization_serial;
    184       struct GNUNET_TIME_Timestamp collection_time;
    185       struct GNUNET_TIME_Timestamp expiration_time;
    186       char *form_name; /**< NULL if the attributes came from a provider */
    187       bool by_aml_officer;
    188       void *encrypted_attributes;
    189       size_t encrypted_attributes_size;
    190     } kyc_attributes;
    191 
    192     struct
    193     {
    194       struct TALER_NormalizedPaytoHashP h_payto;
    195       uint64_t outcome_serial_id;
    196       char *justification;
    197       struct TALER_AmlOfficerPublicKeyP decider_pub;
    198       struct TALER_AmlOfficerSignatureP decider_sig;
    199       /* both NULL/0 unless the AML officer attached attributes to the
    200          decision (see insert_aml_decision.sql) */
    201       struct GNUNET_HashCode kyc_attributes_hash;
    202       bool no_kyc_attributes_hash;
    203       uint64_t kyc_attributes_serial_id;
    204       bool no_kyc_attributes_serial_id;
    205     } aml_history;
    206 
    207     struct
    208     {
    209       struct GNUNET_TIME_Timestamp event_timestamp;
    210       char *event_type;
    211     } kyc_events;
    212 
    213     struct
    214     {
    215       struct TALER_AmlOfficerPublicKeyP decider_pub;
    216       struct TALER_MasterSignatureP master_sig;
    217       char *decider_name;
    218       bool is_active;
    219       bool read_only;
    220       struct GNUNET_TIME_Timestamp last_change;
    221     } aml_staff;
    222 
    223     struct
    224     {
    225       struct TALER_ReservePublicKeyP reserve_pub;
    226       struct GNUNET_TIME_Timestamp expiration_date;
    227       struct GNUNET_TIME_Timestamp gc_date;
    228     } reserves;
    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       struct TALER_ReservePublicKeyP reserve_pub;
    238     } reserves_in;
    239 
    240     struct
    241     {
    242       uint64_t wire_reference;
    243       struct TALER_Amount credit;
    244       struct TALER_FullPaytoHashP sender_account_h_payto;
    245       char *exchange_account_section;
    246       struct GNUNET_TIME_Timestamp execution_date;
    247       union TALER_AccountPublicKeyP account_pub;
    248     } kycauth_in;
    249 
    250     struct
    251     {
    252       struct TALER_ReservePublicKeyP reserve_pub;
    253       struct GNUNET_TIME_Timestamp request_timestamp;
    254       struct GNUNET_TIME_Timestamp expiration_date;
    255       struct TALER_ReserveSignatureP reserve_sig;
    256       struct TALER_Amount reserve_payment;
    257       uint32_t requested_purse_limit;
    258     } reserves_open_requests;
    259 
    260     struct
    261     {
    262       struct TALER_ReservePublicKeyP reserve_pub;
    263       struct TALER_CoinSpendPublicKeyP coin_pub;
    264       struct TALER_CoinSpendSignatureP coin_sig;
    265       struct TALER_ReserveSignatureP reserve_sig;
    266       struct TALER_Amount contribution;
    267     } reserves_open_deposits;
    268 
    269     struct
    270     {
    271       struct TALER_ReservePublicKeyP reserve_pub;
    272       struct GNUNET_TIME_Timestamp execution_date;
    273       struct TALER_WireTransferIdentifierRawP wtid;
    274       struct TALER_FullPaytoHashP sender_account_h_payto;
    275       struct TALER_Amount amount;
    276       struct TALER_Amount closing_fee;
    277     } reserves_close;
    278 
    279     struct
    280     {
    281       struct TALER_AuditorPublicKeyP auditor_pub;
    282       char *auditor_url;
    283       char *auditor_name;
    284       bool is_active;
    285       struct GNUNET_TIME_Timestamp last_change;
    286     } auditors;
    287 
    288     struct
    289     {
    290       uint64_t auditor_uuid;
    291       uint64_t denominations_serial;
    292       struct TALER_AuditorSignatureP auditor_sig;
    293     } auditor_denom_sigs;
    294 
    295     struct
    296     {
    297       struct TALER_ExchangePublicKeyP exchange_pub;
    298       struct TALER_MasterSignatureP master_sig;
    299       struct TALER_EXCHANGEDB_SignkeyMetaData meta;
    300     } exchange_sign_keys;
    301 
    302     struct
    303     {
    304       uint64_t esk_serial;
    305       struct TALER_MasterSignatureP master_sig;
    306     } signkey_revocations;
    307 
    308     struct
    309     {
    310       struct TALER_CoinSpendPublicKeyP coin_pub;
    311       struct TALER_AgeCommitmentHashP age_hash;
    312       uint64_t denominations_serial;
    313       struct TALER_DenominationSignature denom_sig;
    314     } known_coins;
    315 
    316     struct
    317     {
    318       struct TALER_RefreshCommitmentP rc;
    319       struct GNUNET_TIME_Timestamp execution_date;
    320       struct TALER_Amount amount_with_fee;
    321       struct TALER_CoinSpendPublicKeyP old_coin_pub;
    322       struct TALER_CoinSpendSignatureP old_coin_sig;
    323       struct TALER_PublicRefreshMasterSeedP refresh_seed;
    324       uint32_t noreveal_index;
    325       struct TALER_HashBlindedPlanchetsP planchets_h;
    326       struct TALER_HashBlindedPlanchetsP selected_h;
    327       bool no_blinding_seed;
    328       struct TALER_BlindingMasterSeedP blinding_seed;
    329       size_t num_cs_r_values;
    330       struct GNUNET_CRYPTO_CSPublicRPairP *cs_r_values;
    331       uint64_t cs_r_choices;
    332       size_t num_coins;
    333       uint64_t *denom_serials;
    334       struct TALER_BlindedDenominationSignature *denom_sigs;
    335     } refresh;
    336 
    337     struct
    338     {
    339       uint64_t shard;
    340       struct TALER_MerchantPublicKeyP merchant_pub;
    341       struct GNUNET_TIME_Timestamp wallet_timestamp;
    342       struct GNUNET_TIME_Timestamp exchange_timestamp;
    343       struct GNUNET_TIME_Timestamp refund_deadline;
    344       struct GNUNET_TIME_Timestamp wire_deadline;
    345       struct TALER_PrivateContractHashP h_contract_terms;
    346       bool no_wallet_data_hash;
    347       struct GNUNET_HashCode wallet_data_hash;
    348       struct TALER_WireSaltP wire_salt;
    349       struct TALER_FullPaytoHashP wire_target_h_payto;
    350       struct TALER_Amount total_amount;
    351       struct TALER_Amount total_without_fee;
    352       struct TALER_MerchantSignatureP merchant_sig;
    353       bool done;
    354     } batch_deposits;
    355 
    356     struct
    357     {
    358       uint64_t batch_deposit_serial_id;
    359       struct TALER_CoinSpendPublicKeyP coin_pub;
    360       struct TALER_CoinSpendSignatureP coin_sig;
    361       struct TALER_Amount amount_with_fee;
    362     } coin_deposits;
    363 
    364     struct
    365     {
    366       struct TALER_CoinSpendPublicKeyP coin_pub;
    367       uint64_t batch_deposit_serial_id;
    368       struct TALER_MerchantSignatureP merchant_sig;
    369       uint64_t rtransaction_id;
    370       struct TALER_Amount amount_with_fee;
    371     } refunds;
    372 
    373     struct
    374     {
    375       struct GNUNET_TIME_Timestamp execution_date;
    376       struct TALER_WireTransferIdentifierRawP wtid_raw;
    377       struct TALER_FullPaytoHashP wire_target_h_payto;
    378       char *exchange_account_section;
    379       struct TALER_Amount amount;
    380     } wire_out;
    381 
    382     struct
    383     {
    384       uint64_t batch_deposit_serial_id;
    385       struct TALER_WireTransferIdentifierRawP wtid_raw;
    386     } aggregation_tracking;
    387 
    388     struct
    389     {
    390       uint64_t batch_deposit_serial_id;
    391       struct TALER_WireTransferIdentifierRawP wtid_raw;
    392       struct TALER_FullPaytoHashP wire_target_h_payto;
    393       struct TALER_Amount amount;
    394       uint32_t deferral_reason;
    395       uint64_t legitimization_requirement_serial_id;
    396       struct GNUNET_TIME_Timestamp deferral_time;
    397     } aggregation_deferrals;
    398 
    399     struct
    400     {
    401       char *wire_method;
    402       struct GNUNET_TIME_Timestamp start_date;
    403       struct GNUNET_TIME_Timestamp end_date;
    404       struct TALER_WireFeeSet fees;
    405       struct TALER_MasterSignatureP master_sig;
    406     } wire_fee;
    407 
    408     struct
    409     {
    410       struct GNUNET_TIME_Timestamp start_date;
    411       struct GNUNET_TIME_Timestamp end_date;
    412       struct TALER_GlobalFeeSet fees;
    413       struct GNUNET_TIME_Relative purse_timeout;
    414       struct GNUNET_TIME_Relative history_expiration;
    415       uint32_t purse_account_limit;
    416       struct TALER_MasterSignatureP master_sig;
    417     } global_fee;
    418 
    419     struct
    420     {
    421       struct TALER_CoinSpendPublicKeyP coin_pub;
    422       struct TALER_CoinSpendSignatureP coin_sig;
    423       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    424       struct TALER_Amount amount;
    425       struct GNUNET_TIME_Timestamp timestamp;
    426       uint64_t withdraw_serial_id;
    427       uint32_t coin_index;
    428     } recoup;
    429 
    430     struct
    431     {
    432       uint64_t known_coin_id;
    433       struct TALER_CoinSpendPublicKeyP coin_pub;
    434       struct TALER_CoinSpendSignatureP coin_sig;
    435       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    436       struct TALER_Amount amount;
    437       struct GNUNET_TIME_Timestamp recoup_timestamp;
    438       uint64_t refresh_id;
    439       uint32_t coin_index;
    440     } recoup_refresh;
    441 
    442     struct
    443     {
    444       struct TALER_PurseContractPublicKeyP purse_pub;
    445       struct TALER_PurseMergePublicKeyP merge_pub;
    446       struct GNUNET_TIME_Timestamp purse_creation;
    447       struct GNUNET_TIME_Timestamp purse_expiration;
    448       struct TALER_PrivateContractHashP h_contract_terms;
    449       uint32_t age_limit;
    450       uint32_t flags;
    451       struct TALER_Amount amount_with_fee;
    452       struct TALER_Amount purse_fee;
    453       struct TALER_PurseContractSignatureP purse_sig;
    454     } purse_requests;
    455 
    456     struct
    457     {
    458       struct TALER_PurseContractPublicKeyP purse_pub;
    459       struct GNUNET_TIME_Timestamp action_timestamp;
    460       bool refunded;
    461     } purse_decision;
    462 
    463     struct
    464     {
    465       uint64_t partner_serial_id;
    466       struct TALER_ReservePublicKeyP reserve_pub;
    467       struct TALER_PurseContractPublicKeyP purse_pub;
    468       struct TALER_PurseMergeSignatureP merge_sig;
    469       struct GNUNET_TIME_Timestamp merge_timestamp;
    470     } purse_merges;
    471 
    472     struct
    473     {
    474       uint64_t partner_serial_id;
    475       struct TALER_PurseContractPublicKeyP purse_pub;
    476       struct TALER_CoinSpendPublicKeyP coin_pub;
    477       struct TALER_Amount amount_with_fee;
    478       struct TALER_CoinSpendSignatureP coin_sig;
    479     } purse_deposits;
    480 
    481     struct
    482     {
    483       struct TALER_ReservePublicKeyP reserve_pub;
    484       struct TALER_ReserveSignatureP reserve_sig;
    485       struct TALER_PurseContractPublicKeyP purse_pub;
    486       struct TALER_NormalizedPaytoHashP wallet_h_payto;
    487     } account_merges;
    488 
    489     struct
    490     {
    491       struct TALER_ReservePublicKeyP reserve_pub;
    492       struct TALER_ReserveSignatureP reserve_sig;
    493       struct GNUNET_TIME_Timestamp request_timestamp;
    494       struct TALER_Amount history_fee;
    495     } history_requests;
    496 
    497     struct
    498     {
    499       struct TALER_ReservePublicKeyP reserve_pub;
    500       struct GNUNET_TIME_Timestamp close_timestamp;
    501       struct TALER_ReserveSignatureP reserve_sig;
    502       struct TALER_Amount close;
    503       struct TALER_Amount close_fee;
    504       struct TALER_FullPayto payto_uri;
    505     } close_requests;
    506 
    507     struct
    508     {
    509       struct TALER_WadIdentifierP wad_id;
    510       uint64_t partner_serial_id;
    511       struct TALER_Amount amount;
    512       struct GNUNET_TIME_Timestamp execution_time;
    513     } wads_out;
    514 
    515     struct
    516     {
    517       uint64_t wad_out_serial_id;
    518       struct TALER_ReservePublicKeyP reserve_pub;
    519       struct TALER_PurseContractPublicKeyP purse_pub;
    520       struct TALER_PrivateContractHashP h_contract;
    521       struct GNUNET_TIME_Timestamp purse_expiration;
    522       struct GNUNET_TIME_Timestamp merge_timestamp;
    523       struct TALER_Amount amount_with_fee;
    524       struct TALER_Amount wad_fee;
    525       struct TALER_Amount deposit_fees;
    526       struct TALER_ReserveSignatureP reserve_sig;
    527       struct TALER_PurseContractSignatureP purse_sig;
    528     } wads_out_entries;
    529 
    530     struct
    531     {
    532       struct TALER_WadIdentifierP wad_id;
    533       char *origin_exchange_url;
    534       struct TALER_Amount amount;
    535       struct GNUNET_TIME_Timestamp arrival_time;
    536     } wads_in;
    537 
    538     struct
    539     {
    540       uint64_t wad_in_serial_id;
    541       struct TALER_ReservePublicKeyP reserve_pub;
    542       struct TALER_PurseContractPublicKeyP purse_pub;
    543       struct TALER_PrivateContractHashP h_contract;
    544       struct GNUNET_TIME_Timestamp purse_expiration;
    545       struct GNUNET_TIME_Timestamp merge_timestamp;
    546       struct TALER_Amount amount_with_fee;
    547       struct TALER_Amount wad_fee;
    548       struct TALER_Amount deposit_fees;
    549       struct TALER_ReserveSignatureP reserve_sig;
    550       struct TALER_PurseContractSignatureP purse_sig;
    551     } wads_in_entries;
    552 
    553     struct
    554     {
    555       struct TALER_WireTransferIdentifierRawP wtid;
    556       char *account_section;
    557       struct TALER_FullPayto payto_uri;
    558       struct GNUNET_TIME_Timestamp trigger_date;
    559       struct TALER_Amount amount;
    560       struct TALER_MasterSignatureP master_sig;
    561     } profit_drains;
    562 
    563     struct
    564     {
    565       struct TALER_PurseContractPublicKeyP purse_pub;
    566       struct TALER_PurseContractSignatureP purse_sig;
    567     } purse_deletion;
    568 
    569     struct
    570     {
    571       struct TALER_HashBlindedPlanchetsP planchets_h;
    572       struct GNUNET_TIME_Timestamp execution_date;
    573       struct TALER_Amount amount_with_fee;
    574       struct TALER_ReservePublicKeyP reserve_pub;
    575       struct TALER_ReserveSignatureP reserve_sig;
    576       bool age_proof_required;
    577       uint16_t max_age;
    578       uint16_t noreveal_index;
    579       struct TALER_HashBlindedPlanchetsP selected_h;
    580       bool no_blinding_seed;
    581       struct TALER_BlindingMasterSeedP blinding_seed;
    582       size_t num_cs_r_values;
    583       struct GNUNET_CRYPTO_CSPublicRPairP *cs_r_values;
    584       uint64_t cs_r_choices;
    585       size_t num_coins;
    586       uint64_t *denom_serials;
    587       struct TALER_BlindedDenominationSignature *denom_sigs;
    588     } withdraw;
    589 
    590   } details;
    591 
    592 };
    593 
    594 
    595 /**
    596  * Function called on data to replicate in the auditor's database.
    597  *
    598  * @param cls closure
    599  * @param td record from an exchange table
    600  * @return #GNUNET_OK to continue to iterate,
    601  *         #GNUNET_SYSERR to fail with an error
    602  */
    603 #ifndef TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE
    604 /**
    605  * Type of the closure for #TALER_EXCHANGEDB_ReplicationCallback.
    606  */
    607 #define TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE void
    608 #endif
    609 typedef int
    610 (*TALER_EXCHANGEDB_ReplicationCallback)(
    611   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cls,
    612   const struct TALER_EXCHANGEDB_TableData *td);
    613 
    614 
    615 /**
    616  * Function called on data to replicate in the auditor's database.
    617  *
    618  * @param cls closure
    619  * @param td record from an exchange table
    620  * @return #GNUNET_OK to continue to iterate,
    621  *         #GNUNET_SYSERR to fail with an error
    622  */
    623 typedef int
    624 (*TALER_EXCHANGEDB_ReplicationCallback)(
    625   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cls,
    626   const struct TALER_EXCHANGEDB_TableData *td);
    627 
    628 
    629 /**
    630  * Lookup records above @a serial number in @a table. Used in
    631  * exchange-auditor database replication.
    632  *
    633  * No primary test table; exercised by test_replication.c.
    634  *
    635  * @param pg the database context
    636  * @param table table for which we should return the serial
    637  * @param serial largest serial number to exclude
    638  * @param cb function to call on the records
    639  * @param cb_cls closure for @a cb
    640  * @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
    641  *         @a table does not have a serial number
    642  */
    643 enum GNUNET_DB_QueryStatus
    644 TALER_EXCHANGEDB_iterate_records_by_table (
    645   struct TALER_EXCHANGEDB_PostgresContext *pg,
    646   enum TALER_EXCHANGEDB_ReplicatedTable table,
    647   uint64_t serial,
    648   TALER_EXCHANGEDB_ReplicationCallback cb,
    649   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cb_cls);
    650 
    651 
    652 #endif