1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
|
/*
This file is part of GNUnet
Copyright (C) 2020, 2021 Taler Systems SA
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
* @file exchangedb/irbt_callbacks.c
* @brief callbacks used by postgres_insert_records_by_table, to be
* inlined into the plugin
* @author Christian Grothoff
*/
/**
* Function called with denominations records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_denominations (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct TALER_DenominationHash denom_hash;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&denom_hash),
TALER_PQ_query_param_denom_pub (
&td->details.denominations.denom_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.denominations.master_sig),
TALER_PQ_query_param_absolute_time (
&td->details.denominations.valid_from),
TALER_PQ_query_param_absolute_time (
&td->details.denominations.expire_withdraw),
TALER_PQ_query_param_absolute_time (
&td->details.denominations.expire_deposit),
TALER_PQ_query_param_absolute_time (
&td->details.denominations.expire_legal),
TALER_PQ_query_param_amount (&td->details.denominations.coin),
TALER_PQ_query_param_amount (
&td->details.denominations.fee_withdraw),
TALER_PQ_query_param_amount (
&td->details.denominations.fee_deposit),
TALER_PQ_query_param_amount (
&td->details.denominations.fee_refresh),
TALER_PQ_query_param_amount (
&td->details.denominations.fee_refund),
GNUNET_PQ_query_param_end
};
TALER_denom_pub_hash (
&td->details.denominations.denom_pub,
&denom_hash);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_denominations",
params);
}
/**
* Function called with denomination_revocations records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_denomination_revocations (
struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.denomination_revocations.master_sig),
GNUNET_PQ_query_param_uint64 (
&td->details.denomination_revocations.denominations_serial),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_denomination_revocations",
params);
}
/**
* Function called with denominations records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_wire_targets (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct TALER_PaytoHash payto_hash;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&payto_hash),
GNUNET_PQ_query_param_string (
td->details.wire_targets.payto_uri),
GNUNET_PQ_query_param_auto_from_type (
&td->details.wire_targets.kyc_ok),
GNUNET_PQ_query_param_string (
td->details.wire_targets.oauth_username),
GNUNET_PQ_query_param_end
};
TALER_payto_hash (
td->details.wire_targets.payto_uri,
&payto_hash);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_wire_targets",
params);
}
/**
* Function called with reserves records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_reserves (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.reserves.reserve_pub),
TALER_PQ_query_param_amount (&td->details.reserves.current_balance),
TALER_PQ_query_param_absolute_time (&td->details.reserves.expiration_date),
TALER_PQ_query_param_absolute_time (&td->details.reserves.gc_date),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_reserves",
params);
}
/**
* Function called with reserves_in records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_reserves_in (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.wire_reference),
TALER_PQ_query_param_amount (&td->details.reserves_in.credit),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.sender_account),
GNUNET_PQ_query_param_string (
td->details.reserves_in.exchange_account_section),
TALER_PQ_query_param_absolute_time (
&td->details.reserves_in.execution_date),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.reserve_uuid),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_reserves_in",
params);
}
/**
* Function called with reserves_close records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_reserves_close (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
TALER_PQ_query_param_absolute_time (
&td->details.reserves_close.execution_date),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_close.wtid),
GNUNET_PQ_query_param_uint64 (
&td->details.reserves_close.wire_target_serial_id),
TALER_PQ_query_param_amount (&td->details.reserves_close.amount),
TALER_PQ_query_param_amount (&td->details.reserves_close.closing_fee),
GNUNET_PQ_query_param_uint64 (&td->details.reserves_close.reserve_uuid),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_reserves_close",
params);
}
/**
* Function called with reserves_out records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_reserves_out (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_out.h_blind_ev),
GNUNET_PQ_query_param_uint64 (
&td->details.reserves_out.denominations_serial),
TALER_PQ_query_param_blinded_denom_sig (
&td->details.reserves_out.denom_sig),
GNUNET_PQ_query_param_uint64 (
&td->details.reserves_out.reserve_uuid),
GNUNET_PQ_query_param_auto_from_type (
&td->details.reserves_out.reserve_sig),
TALER_PQ_query_param_absolute_time (
&td->details.reserves_out.execution_date),
TALER_PQ_query_param_amount (
&td->details.reserves_out.amount_with_fee),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_reserves_out",
params);
}
/**
* Function called with auditors records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_auditors (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
uint8_t is_active = td->details.auditors.is_active ? 1 : 0;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.auditors.auditor_pub),
GNUNET_PQ_query_param_string (td->details.auditors.auditor_name),
GNUNET_PQ_query_param_string (td->details.auditors.auditor_url),
GNUNET_PQ_query_param_auto_from_type (&is_active),
GNUNET_PQ_query_param_absolute_time (&td->details.auditors.last_change),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_auditors",
params);
}
/**
* Function called with auditor_denom_sigs records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_auditor_denom_sigs (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (&td->details.auditor_denom_sigs.auditor_uuid),
GNUNET_PQ_query_param_uint64 (
&td->details.auditor_denom_sigs.denominations_serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.auditor_denom_sigs.auditor_sig),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_auditor_denom_sigs",
params);
}
/**
* Function called with exchange_sign_keys records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_exchange_sign_keys (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.exchange_sign_keys.exchange_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.exchange_sign_keys.master_sig),
TALER_PQ_query_param_absolute_time (
&td->details.exchange_sign_keys.meta.start),
TALER_PQ_query_param_absolute_time (
&td->details.exchange_sign_keys.meta.expire_sign),
TALER_PQ_query_param_absolute_time (
&td->details.exchange_sign_keys.meta.expire_legal),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_exchange_sign_keys",
params);
}
/**
* Function called with signkey_revocations records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_signkey_revocations (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (&td->details.signkey_revocations.esk_serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.signkey_revocations.master_sig),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_signkey_revocations",
params);
}
/**
* Function called with known_coins records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_known_coins (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.known_coins.coin_pub),
TALER_PQ_query_param_denom_sig (
&td->details.known_coins.denom_sig),
GNUNET_PQ_query_param_uint64 (
&td->details.known_coins.denominations_serial),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_known_coins",
params);
}
/**
* Function called with refresh_commitments records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_refresh_commitments (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.refresh_commitments.rc),
GNUNET_PQ_query_param_auto_from_type (
&td->details.refresh_commitments.old_coin_sig),
TALER_PQ_query_param_amount (
&td->details.refresh_commitments.amount_with_fee),
GNUNET_PQ_query_param_uint32 (
&td->details.refresh_commitments.noreveal_index),
GNUNET_PQ_query_param_uint64 (
&td->details.refresh_commitments.old_known_coin_id),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_refresh_commitments",
params);
}
/**
* Function called with refresh_revealed_coins records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_refresh_revealed_coins (
struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_HashCode h_coin_ev;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint32 (
&td->details.refresh_revealed_coins.freshcoin_index),
GNUNET_PQ_query_param_auto_from_type (
&td->details.refresh_revealed_coins.link_sig),
GNUNET_PQ_query_param_fixed_size (
td->details.refresh_revealed_coins.coin_ev,
td->details.refresh_revealed_coins.
coin_ev_size),
GNUNET_PQ_query_param_auto_from_type (&h_coin_ev),
TALER_PQ_query_param_blinded_denom_sig (
&td->details.refresh_revealed_coins.ev_sig),
GNUNET_PQ_query_param_uint64 (
&td->details.refresh_revealed_coins.denominations_serial),
GNUNET_PQ_query_param_uint64 (
&td->details.refresh_revealed_coins.melt_serial_id),
GNUNET_PQ_query_param_end
};
GNUNET_CRYPTO_hash (td->details.refresh_revealed_coins.coin_ev,
td->details.refresh_revealed_coins.coin_ev_size,
&h_coin_ev);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_refresh_revealed_coins",
params);
}
/**
* Function called with refresh_transfer_keys records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_refresh_transfer_keys (
struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (
&td->details.refresh_transfer_keys.tp),
GNUNET_PQ_query_param_fixed_size (
&td->details.refresh_transfer_keys.tprivs[0],
(TALER_CNC_KAPPA - 1)
* sizeof (struct TALER_TransferPrivateKeyP)),
GNUNET_PQ_query_param_uint64 (
&td->details.refresh_transfer_keys.melt_serial_id),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_refresh_transfer_keys",
params);
}
/**
* Function called with deposits records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_deposits (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
uint8_t tiny = td->details.deposits.tiny ? 1 : 0;
uint8_t done = td->details.deposits.done ? 1 : 0;
uint8_t extension_blocked = td->details.deposits.extension_blocked ? 1 : 0;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.known_coin_id),
TALER_PQ_query_param_amount (&td->details.deposits.amount_with_fee),
TALER_PQ_query_param_absolute_time (&td->details.deposits.wallet_timestamp),
TALER_PQ_query_param_absolute_time (
&td->details.deposits.exchange_timestamp),
TALER_PQ_query_param_absolute_time (&td->details.deposits.refund_deadline),
TALER_PQ_query_param_absolute_time (&td->details.deposits.wire_deadline),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.merchant_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.deposits.h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.coin_sig),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.wire_salt),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.wire_target_serial_id),
GNUNET_PQ_query_param_auto_from_type (&tiny),
GNUNET_PQ_query_param_auto_from_type (&done),
GNUNET_PQ_query_param_auto_from_type (&extension_blocked),
GNUNET_PQ_query_param_uint64 (
&td->details.deposits.extension_details_serial_id),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_deposits",
params);
}
/**
* Function called with refunds records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_refunds (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.refunds.merchant_sig),
GNUNET_PQ_query_param_uint64 (&td->details.refunds.rtransaction_id),
TALER_PQ_query_param_amount (&td->details.refunds.amount_with_fee),
GNUNET_PQ_query_param_uint64 (&td->details.refunds.deposit_serial_id),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_refunds",
params);
}
/**
* Function called with wire_out records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_wire_out (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
TALER_PQ_query_param_absolute_time (&td->details.wire_out.execution_date),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_out.wtid_raw),
GNUNET_PQ_query_param_uint64 (&td->details.wire_out.wire_target_serial_id),
GNUNET_PQ_query_param_string (
td->details.wire_out.exchange_account_section),
TALER_PQ_query_param_amount (&td->details.wire_out.amount),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_wire_out",
params);
}
/**
* Function called with aggregation_tracking records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_aggregation_tracking (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (
&td->details.aggregation_tracking.deposit_serial_id),
GNUNET_PQ_query_param_auto_from_type (
&td->details.aggregation_tracking.wtid_raw),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_aggregation_tracking",
params);
}
/**
* Function called with wire_fee records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_wire_fee (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_string (td->details.wire_fee.wire_method),
TALER_PQ_query_param_absolute_time (&td->details.wire_fee.start_date),
TALER_PQ_query_param_absolute_time (&td->details.wire_fee.end_date),
TALER_PQ_query_param_amount (&td->details.wire_fee.wire_fee),
TALER_PQ_query_param_amount (&td->details.wire_fee.closing_fee),
GNUNET_PQ_query_param_auto_from_type (&td->details.wire_fee.master_sig),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_wire_fee",
params);
}
/**
* Function called with recoup records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_recoup (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_sig),
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_blind),
TALER_PQ_query_param_amount (&td->details.recoup.amount),
TALER_PQ_query_param_absolute_time (&td->details.recoup.timestamp),
GNUNET_PQ_query_param_uint64 (&td->details.recoup.known_coin_id),
GNUNET_PQ_query_param_uint64 (&td->details.recoup.reserve_out_serial_id),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_recoup",
params);
}
/**
* Function called with recoup_refresh records to insert into table.
*
* @param pg plugin context
* @param td record to insert
*/
static enum GNUNET_DB_QueryStatus
irbt_cb_table_recoup_refresh (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.recoup_refresh.coin_sig),
GNUNET_PQ_query_param_auto_from_type (
&td->details.recoup_refresh.coin_blind),
TALER_PQ_query_param_amount (&td->details.recoup_refresh.amount),
TALER_PQ_query_param_absolute_time (&td->details.recoup_refresh.timestamp),
GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.known_coin_id),
GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.rrc_serial),
GNUNET_PQ_query_param_end
};
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_into_table_recoup_refresh",
params);
}
/* end of irbt_callbacks.c */
|