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 (19846B)


      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     } recoup;
    428 
    429     struct
    430     {
    431       uint64_t known_coin_id;
    432       struct TALER_CoinSpendPublicKeyP coin_pub;
    433       struct TALER_CoinSpendSignatureP coin_sig;
    434       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    435       struct TALER_Amount amount;
    436       struct GNUNET_TIME_Timestamp recoup_timestamp;
    437       uint64_t refresh_id;
    438     } recoup_refresh;
    439 
    440     struct
    441     {
    442       struct TALER_PurseContractPublicKeyP purse_pub;
    443       struct TALER_PurseMergePublicKeyP merge_pub;
    444       struct GNUNET_TIME_Timestamp purse_creation;
    445       struct GNUNET_TIME_Timestamp purse_expiration;
    446       struct TALER_PrivateContractHashP h_contract_terms;
    447       uint32_t age_limit;
    448       uint32_t flags;
    449       struct TALER_Amount amount_with_fee;
    450       struct TALER_Amount purse_fee;
    451       struct TALER_PurseContractSignatureP purse_sig;
    452     } purse_requests;
    453 
    454     struct
    455     {
    456       struct TALER_PurseContractPublicKeyP purse_pub;
    457       struct GNUNET_TIME_Timestamp action_timestamp;
    458       bool refunded;
    459     } purse_decision;
    460 
    461     struct
    462     {
    463       uint64_t partner_serial_id;
    464       struct TALER_ReservePublicKeyP reserve_pub;
    465       struct TALER_PurseContractPublicKeyP purse_pub;
    466       struct TALER_PurseMergeSignatureP merge_sig;
    467       struct GNUNET_TIME_Timestamp merge_timestamp;
    468     } purse_merges;
    469 
    470     struct
    471     {
    472       uint64_t partner_serial_id;
    473       struct TALER_PurseContractPublicKeyP purse_pub;
    474       struct TALER_CoinSpendPublicKeyP coin_pub;
    475       struct TALER_Amount amount_with_fee;
    476       struct TALER_CoinSpendSignatureP coin_sig;
    477     } purse_deposits;
    478 
    479     struct
    480     {
    481       struct TALER_ReservePublicKeyP reserve_pub;
    482       struct TALER_ReserveSignatureP reserve_sig;
    483       struct TALER_PurseContractPublicKeyP purse_pub;
    484       struct TALER_NormalizedPaytoHashP wallet_h_payto;
    485     } account_merges;
    486 
    487     struct
    488     {
    489       struct TALER_ReservePublicKeyP reserve_pub;
    490       struct TALER_ReserveSignatureP reserve_sig;
    491       struct GNUNET_TIME_Timestamp request_timestamp;
    492       struct TALER_Amount history_fee;
    493     } history_requests;
    494 
    495     struct
    496     {
    497       struct TALER_ReservePublicKeyP reserve_pub;
    498       struct GNUNET_TIME_Timestamp close_timestamp;
    499       struct TALER_ReserveSignatureP reserve_sig;
    500       struct TALER_Amount close;
    501       struct TALER_Amount close_fee;
    502       struct TALER_FullPayto payto_uri;
    503     } close_requests;
    504 
    505     struct
    506     {
    507       struct TALER_WadIdentifierP wad_id;
    508       uint64_t partner_serial_id;
    509       struct TALER_Amount amount;
    510       struct GNUNET_TIME_Timestamp execution_time;
    511     } wads_out;
    512 
    513     struct
    514     {
    515       uint64_t wad_out_serial_id;
    516       struct TALER_ReservePublicKeyP reserve_pub;
    517       struct TALER_PurseContractPublicKeyP purse_pub;
    518       struct TALER_PrivateContractHashP h_contract;
    519       struct GNUNET_TIME_Timestamp purse_expiration;
    520       struct GNUNET_TIME_Timestamp merge_timestamp;
    521       struct TALER_Amount amount_with_fee;
    522       struct TALER_Amount wad_fee;
    523       struct TALER_Amount deposit_fees;
    524       struct TALER_ReserveSignatureP reserve_sig;
    525       struct TALER_PurseContractSignatureP purse_sig;
    526     } wads_out_entries;
    527 
    528     struct
    529     {
    530       struct TALER_WadIdentifierP wad_id;
    531       char *origin_exchange_url;
    532       struct TALER_Amount amount;
    533       struct GNUNET_TIME_Timestamp arrival_time;
    534     } wads_in;
    535 
    536     struct
    537     {
    538       uint64_t wad_in_serial_id;
    539       struct TALER_ReservePublicKeyP reserve_pub;
    540       struct TALER_PurseContractPublicKeyP purse_pub;
    541       struct TALER_PrivateContractHashP h_contract;
    542       struct GNUNET_TIME_Timestamp purse_expiration;
    543       struct GNUNET_TIME_Timestamp merge_timestamp;
    544       struct TALER_Amount amount_with_fee;
    545       struct TALER_Amount wad_fee;
    546       struct TALER_Amount deposit_fees;
    547       struct TALER_ReserveSignatureP reserve_sig;
    548       struct TALER_PurseContractSignatureP purse_sig;
    549     } wads_in_entries;
    550 
    551     struct
    552     {
    553       struct TALER_WireTransferIdentifierRawP wtid;
    554       char *account_section;
    555       struct TALER_FullPayto payto_uri;
    556       struct GNUNET_TIME_Timestamp trigger_date;
    557       struct TALER_Amount amount;
    558       struct TALER_MasterSignatureP master_sig;
    559     } profit_drains;
    560 
    561     struct
    562     {
    563       struct TALER_PurseContractPublicKeyP purse_pub;
    564       struct TALER_PurseContractSignatureP purse_sig;
    565     } purse_deletion;
    566 
    567     struct
    568     {
    569       struct TALER_HashBlindedPlanchetsP planchets_h;
    570       struct GNUNET_TIME_Timestamp execution_date;
    571       struct TALER_Amount amount_with_fee;
    572       struct TALER_ReservePublicKeyP reserve_pub;
    573       struct TALER_ReserveSignatureP reserve_sig;
    574       bool age_proof_required;
    575       uint16_t max_age;
    576       uint16_t noreveal_index;
    577       struct TALER_HashBlindedPlanchetsP selected_h;
    578       bool no_blinding_seed;
    579       struct TALER_BlindingMasterSeedP blinding_seed;
    580       size_t num_cs_r_values;
    581       struct GNUNET_CRYPTO_CSPublicRPairP *cs_r_values;
    582       uint64_t cs_r_choices;
    583       size_t num_coins;
    584       uint64_t *denom_serials;
    585       struct TALER_BlindedDenominationSignature *denom_sigs;
    586     } withdraw;
    587 
    588   } details;
    589 
    590 };
    591 
    592 
    593 /**
    594  * Function called on data to replicate in the auditor's database.
    595  *
    596  * @param cls closure
    597  * @param td record from an exchange table
    598  * @return #GNUNET_OK to continue to iterate,
    599  *         #GNUNET_SYSERR to fail with an error
    600  */
    601 #ifndef TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE
    602 /**
    603  * Type of the closure for #TALER_EXCHANGEDB_ReplicationCallback.
    604  */
    605 #define TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE void
    606 #endif
    607 typedef int
    608 (*TALER_EXCHANGEDB_ReplicationCallback)(
    609   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cls,
    610   const struct TALER_EXCHANGEDB_TableData *td);
    611 
    612 
    613 /**
    614  * Function called on data to replicate in the auditor's database.
    615  *
    616  * @param cls closure
    617  * @param td record from an exchange table
    618  * @return #GNUNET_OK to continue to iterate,
    619  *         #GNUNET_SYSERR to fail with an error
    620  */
    621 typedef int
    622 (*TALER_EXCHANGEDB_ReplicationCallback)(
    623   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cls,
    624   const struct TALER_EXCHANGEDB_TableData *td);
    625 
    626 
    627 /**
    628  * Lookup records above @a serial number in @a table. Used in
    629  * exchange-auditor database replication.
    630  *
    631  * @param pg the database context
    632  * @param table table for which we should return the serial
    633  * @param serial largest serial number to exclude
    634  * @param cb function to call on the records
    635  * @param cb_cls closure for @a cb
    636  * @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
    637  *         @a table does not have a serial number
    638  */
    639 enum GNUNET_DB_QueryStatus
    640 TALER_EXCHANGEDB_iterate_records_by_table (
    641   struct TALER_EXCHANGEDB_PostgresContext *pg,
    642   enum TALER_EXCHANGEDB_ReplicatedTable table,
    643   uint64_t serial,
    644   TALER_EXCHANGEDB_ReplicationCallback cb,
    645   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cb_cls);
    646 
    647 
    648 #endif