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


      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       /* NULL for v27 melts, otherwise @e num_coins many */
    336       struct TALER_TransferPublicKeyP *transfer_pubs;
    337       bool revealed;
    338       uint32_t rc_version;
    339     } refresh;
    340 
    341     struct
    342     {
    343       uint64_t shard;
    344       struct TALER_MerchantPublicKeyP merchant_pub;
    345       struct GNUNET_TIME_Timestamp wallet_timestamp;
    346       struct GNUNET_TIME_Timestamp exchange_timestamp;
    347       struct GNUNET_TIME_Timestamp refund_deadline;
    348       struct GNUNET_TIME_Timestamp wire_deadline;
    349       struct TALER_PrivateContractHashP h_contract_terms;
    350       bool no_wallet_data_hash;
    351       struct GNUNET_HashCode wallet_data_hash;
    352       struct TALER_WireSaltP wire_salt;
    353       struct TALER_FullPaytoHashP wire_target_h_payto;
    354       struct TALER_Amount total_amount;
    355       struct TALER_Amount total_without_fee;
    356       struct TALER_MerchantSignatureP merchant_sig;
    357       bool done;
    358     } batch_deposits;
    359 
    360     struct
    361     {
    362       uint64_t batch_deposit_serial_id;
    363       struct TALER_CoinSpendPublicKeyP coin_pub;
    364       struct TALER_CoinSpendSignatureP coin_sig;
    365       struct TALER_Amount amount_with_fee;
    366     } coin_deposits;
    367 
    368     struct
    369     {
    370       struct TALER_CoinSpendPublicKeyP coin_pub;
    371       uint64_t batch_deposit_serial_id;
    372       struct TALER_MerchantSignatureP merchant_sig;
    373       uint64_t rtransaction_id;
    374       struct TALER_Amount amount_with_fee;
    375     } refunds;
    376 
    377     struct
    378     {
    379       struct GNUNET_TIME_Timestamp execution_date;
    380       struct TALER_WireTransferIdentifierRawP wtid_raw;
    381       struct TALER_FullPaytoHashP wire_target_h_payto;
    382       char *exchange_account_section;
    383       struct TALER_Amount amount;
    384     } wire_out;
    385 
    386     struct
    387     {
    388       uint64_t batch_deposit_serial_id;
    389       struct TALER_WireTransferIdentifierRawP wtid_raw;
    390     } aggregation_tracking;
    391 
    392     struct
    393     {
    394       uint64_t batch_deposit_serial_id;
    395       struct TALER_WireTransferIdentifierRawP wtid_raw;
    396       struct TALER_FullPaytoHashP wire_target_h_payto;
    397       struct TALER_Amount amount;
    398       uint32_t deferral_reason;
    399       uint64_t legitimization_requirement_serial_id;
    400       struct GNUNET_TIME_Timestamp deferral_time;
    401     } aggregation_deferrals;
    402 
    403     struct
    404     {
    405       char *wire_method;
    406       struct GNUNET_TIME_Timestamp start_date;
    407       struct GNUNET_TIME_Timestamp end_date;
    408       struct TALER_WireFeeSet fees;
    409       struct TALER_MasterSignatureP master_sig;
    410     } wire_fee;
    411 
    412     struct
    413     {
    414       struct GNUNET_TIME_Timestamp start_date;
    415       struct GNUNET_TIME_Timestamp end_date;
    416       struct TALER_GlobalFeeSet fees;
    417       struct GNUNET_TIME_Relative purse_timeout;
    418       struct GNUNET_TIME_Relative history_expiration;
    419       uint32_t purse_account_limit;
    420       struct TALER_MasterSignatureP master_sig;
    421     } global_fee;
    422 
    423     struct
    424     {
    425       struct TALER_CoinSpendPublicKeyP coin_pub;
    426       struct TALER_CoinSpendSignatureP coin_sig;
    427       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    428       struct TALER_Amount amount;
    429       struct GNUNET_TIME_Timestamp timestamp;
    430       uint64_t withdraw_serial_id;
    431       uint32_t coin_index;
    432     } recoup;
    433 
    434     struct
    435     {
    436       uint64_t known_coin_id;
    437       struct TALER_CoinSpendPublicKeyP coin_pub;
    438       struct TALER_CoinSpendSignatureP coin_sig;
    439       union GNUNET_CRYPTO_BlindingSecretP coin_blind;
    440       struct TALER_Amount amount;
    441       struct GNUNET_TIME_Timestamp recoup_timestamp;
    442       uint64_t refresh_id;
    443       uint32_t coin_index;
    444     } recoup_refresh;
    445 
    446     struct
    447     {
    448       struct TALER_PurseContractPublicKeyP purse_pub;
    449       struct TALER_PurseMergePublicKeyP merge_pub;
    450       struct GNUNET_TIME_Timestamp purse_creation;
    451       struct GNUNET_TIME_Timestamp purse_expiration;
    452       struct TALER_PrivateContractHashP h_contract_terms;
    453       uint32_t age_limit;
    454       uint32_t flags;
    455       struct TALER_Amount amount_with_fee;
    456       struct TALER_Amount purse_fee;
    457       struct TALER_PurseContractSignatureP purse_sig;
    458     } purse_requests;
    459 
    460     struct
    461     {
    462       struct TALER_PurseContractPublicKeyP purse_pub;
    463       struct GNUNET_TIME_Timestamp action_timestamp;
    464       bool refunded;
    465     } purse_decision;
    466 
    467     struct
    468     {
    469       uint64_t partner_serial_id;
    470       struct TALER_ReservePublicKeyP reserve_pub;
    471       struct TALER_PurseContractPublicKeyP purse_pub;
    472       struct TALER_PurseMergeSignatureP merge_sig;
    473       struct GNUNET_TIME_Timestamp merge_timestamp;
    474     } purse_merges;
    475 
    476     struct
    477     {
    478       uint64_t partner_serial_id;
    479       struct TALER_PurseContractPublicKeyP purse_pub;
    480       struct TALER_CoinSpendPublicKeyP coin_pub;
    481       struct TALER_Amount amount_with_fee;
    482       struct TALER_CoinSpendSignatureP coin_sig;
    483     } purse_deposits;
    484 
    485     struct
    486     {
    487       struct TALER_ReservePublicKeyP reserve_pub;
    488       struct TALER_ReserveSignatureP reserve_sig;
    489       struct TALER_PurseContractPublicKeyP purse_pub;
    490       struct TALER_NormalizedPaytoHashP wallet_h_payto;
    491     } account_merges;
    492 
    493     struct
    494     {
    495       struct TALER_ReservePublicKeyP reserve_pub;
    496       struct TALER_ReserveSignatureP reserve_sig;
    497       struct GNUNET_TIME_Timestamp request_timestamp;
    498       struct TALER_Amount history_fee;
    499     } history_requests;
    500 
    501     struct
    502     {
    503       struct TALER_ReservePublicKeyP reserve_pub;
    504       struct GNUNET_TIME_Timestamp close_timestamp;
    505       struct TALER_ReserveSignatureP reserve_sig;
    506       struct TALER_Amount close;
    507       struct TALER_Amount close_fee;
    508       struct TALER_FullPayto payto_uri;
    509     } close_requests;
    510 
    511     struct
    512     {
    513       struct TALER_WadIdentifierP wad_id;
    514       uint64_t partner_serial_id;
    515       struct TALER_Amount amount;
    516       struct GNUNET_TIME_Timestamp execution_time;
    517     } wads_out;
    518 
    519     struct
    520     {
    521       uint64_t wad_out_serial_id;
    522       struct TALER_ReservePublicKeyP reserve_pub;
    523       struct TALER_PurseContractPublicKeyP purse_pub;
    524       struct TALER_PrivateContractHashP h_contract;
    525       struct GNUNET_TIME_Timestamp purse_expiration;
    526       struct GNUNET_TIME_Timestamp merge_timestamp;
    527       struct TALER_Amount amount_with_fee;
    528       struct TALER_Amount wad_fee;
    529       struct TALER_Amount deposit_fees;
    530       struct TALER_ReserveSignatureP reserve_sig;
    531       struct TALER_PurseContractSignatureP purse_sig;
    532     } wads_out_entries;
    533 
    534     struct
    535     {
    536       struct TALER_WadIdentifierP wad_id;
    537       char *origin_exchange_url;
    538       struct TALER_Amount amount;
    539       struct GNUNET_TIME_Timestamp arrival_time;
    540     } wads_in;
    541 
    542     struct
    543     {
    544       uint64_t wad_in_serial_id;
    545       struct TALER_ReservePublicKeyP reserve_pub;
    546       struct TALER_PurseContractPublicKeyP purse_pub;
    547       struct TALER_PrivateContractHashP h_contract;
    548       struct GNUNET_TIME_Timestamp purse_expiration;
    549       struct GNUNET_TIME_Timestamp merge_timestamp;
    550       struct TALER_Amount amount_with_fee;
    551       struct TALER_Amount wad_fee;
    552       struct TALER_Amount deposit_fees;
    553       struct TALER_ReserveSignatureP reserve_sig;
    554       struct TALER_PurseContractSignatureP purse_sig;
    555     } wads_in_entries;
    556 
    557     struct
    558     {
    559       struct TALER_WireTransferIdentifierRawP wtid;
    560       char *account_section;
    561       struct TALER_FullPayto payto_uri;
    562       struct GNUNET_TIME_Timestamp trigger_date;
    563       struct TALER_Amount amount;
    564       struct TALER_MasterSignatureP master_sig;
    565     } profit_drains;
    566 
    567     struct
    568     {
    569       struct TALER_PurseContractPublicKeyP purse_pub;
    570       struct TALER_PurseContractSignatureP purse_sig;
    571     } purse_deletion;
    572 
    573     struct
    574     {
    575       struct TALER_HashBlindedPlanchetsP planchets_h;
    576       struct GNUNET_TIME_Timestamp execution_date;
    577       struct TALER_Amount amount_with_fee;
    578       struct TALER_ReservePublicKeyP reserve_pub;
    579       struct TALER_ReserveSignatureP reserve_sig;
    580       bool age_proof_required;
    581       uint16_t max_age;
    582       uint16_t noreveal_index;
    583       struct TALER_HashBlindedPlanchetsP selected_h;
    584       bool no_blinding_seed;
    585       struct TALER_BlindingMasterSeedP blinding_seed;
    586       size_t num_cs_r_values;
    587       struct GNUNET_CRYPTO_CSPublicRPairP *cs_r_values;
    588       uint64_t cs_r_choices;
    589       size_t num_coins;
    590       uint64_t *denom_serials;
    591       struct TALER_BlindedDenominationSignature *denom_sigs;
    592     } withdraw;
    593 
    594   } details;
    595 
    596 };
    597 
    598 
    599 /**
    600  * Function called on data to replicate in the auditor's database.
    601  *
    602  * @param cls closure
    603  * @param td record from an exchange table
    604  * @return #GNUNET_OK to continue to iterate,
    605  *         #GNUNET_SYSERR to fail with an error
    606  */
    607 #ifndef TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE
    608 /**
    609  * Type of the closure for #TALER_EXCHANGEDB_ReplicationCallback.
    610  */
    611 #define TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE void
    612 #endif
    613 typedef int
    614 (*TALER_EXCHANGEDB_ReplicationCallback)(
    615   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *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   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *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  * No primary test table; exercised by test_replication.c.
    638  *
    639  * @param pg the database context
    640  * @param table table for which we should return the serial
    641  * @param serial largest serial number to exclude
    642  * @param cb function to call on the records
    643  * @param cb_cls closure for @a cb
    644  * @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
    645  *         @a table does not have a serial number
    646  */
    647 enum GNUNET_DB_QueryStatus
    648 TALER_EXCHANGEDB_iterate_records_by_table (
    649   struct TALER_EXCHANGEDB_PostgresContext *pg,
    650   enum TALER_EXCHANGEDB_ReplicatedTable table,
    651   uint64_t serial,
    652   TALER_EXCHANGEDB_ReplicationCallback cb,
    653   TALER_EXCHANGEDB_REPLICATION_RESULT_CLOSURE *cb_cls);
    654 
    655 
    656 #endif