diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-26 20:51:21 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-26 20:51:21 +0200 |
commit | 47e4dc13ed7bbfd6504f0ada9bc571564876d9a7 (patch) | |
tree | 1ae3106c313503825408fbb31038bdc2ae4fb5c7 | |
parent | c1ce2a03ed24769af970985b07c30fc2c434526c (diff) | |
download | exchange-47e4dc13ed7bbfd6504f0ada9bc571564876d9a7.tar.gz exchange-47e4dc13ed7bbfd6504f0ada9bc571564876d9a7.zip |
add api to allow clients to force auditor notification of dc
-rw-r--r-- | src/include/taler_exchange_service.h | 10 | ||||
-rw-r--r-- | src/lib/exchange_api_deposit.c | 22 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 991e36f12..0aeffd324 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h | |||
@@ -771,6 +771,16 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, | |||
771 | 771 | ||
772 | 772 | ||
773 | /** | 773 | /** |
774 | * Change the chance that our deposit confirmation will be given to the | ||
775 | * auditor to 100%. | ||
776 | * | ||
777 | * @param deposit the deposit permission request handle | ||
778 | */ | ||
779 | void | ||
780 | TALER_EXCHANGE_deposit_force_dc (struct TALER_EXCHANGE_DepositHandle *deposit); | ||
781 | |||
782 | |||
783 | /** | ||
774 | * Cancel a deposit permission request. This function cannot be used | 784 | * Cancel a deposit permission request. This function cannot be used |
775 | * on a request handle if a response is already served for it. | 785 | * on a request handle if a response is already served for it. |
776 | * | 786 | * |
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index b9f535c7c..cb3e29588 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c | |||
@@ -105,6 +105,12 @@ struct TALER_EXCHANGE_DepositHandle | |||
105 | */ | 105 | */ |
106 | struct TALER_Amount coin_value; | 106 | struct TALER_Amount coin_value; |
107 | 107 | ||
108 | /** | ||
109 | * Chance that we will inform the auditor about the deposit | ||
110 | * is 1:n, where the value of this field is "n". | ||
111 | */ | ||
112 | unsigned int auditor_chance; | ||
113 | |||
108 | }; | 114 | }; |
109 | 115 | ||
110 | 116 | ||
@@ -129,7 +135,7 @@ auditor_cb (void *cls, | |||
129 | struct TEAH_AuditorInteractionEntry *aie; | 135 | struct TEAH_AuditorInteractionEntry *aie; |
130 | 136 | ||
131 | if (0 != GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 137 | if (0 != GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
132 | AUDITOR_CHANCE)) | 138 | dh->auditor_chance)) |
133 | return NULL; | 139 | return NULL; |
134 | key_state = TALER_EXCHANGE_get_keys (dh->exchange); | 140 | key_state = TALER_EXCHANGE_get_keys (dh->exchange); |
135 | spk = TALER_EXCHANGE_get_signing_key_details (key_state, | 141 | spk = TALER_EXCHANGE_get_signing_key_details (key_state, |
@@ -573,6 +579,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, | |||
573 | } | 579 | } |
574 | 580 | ||
575 | dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle); | 581 | dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle); |
582 | dh->auditor_chance = AUDITOR_CHANCE; | ||
576 | dh->exchange = exchange; | 583 | dh->exchange = exchange; |
577 | dh->cb = cb; | 584 | dh->cb = cb; |
578 | dh->cb_cls = cb_cls; | 585 | dh->cb_cls = cb_cls; |
@@ -620,6 +627,19 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, | |||
620 | 627 | ||
621 | 628 | ||
622 | /** | 629 | /** |
630 | * Change the chance that our deposit confirmation will be given to the | ||
631 | * auditor to 100%. | ||
632 | * | ||
633 | * @param deposit the deposit permission request handle | ||
634 | */ | ||
635 | void | ||
636 | TALER_EXCHANGE_deposit_force_dc (struct TALER_EXCHANGE_DepositHandle *deposit) | ||
637 | { | ||
638 | deposit->auditor_chance = 1; | ||
639 | } | ||
640 | |||
641 | |||
642 | /** | ||
623 | * Cancel a deposit permission request. This function cannot be used | 643 | * Cancel a deposit permission request. This function cannot be used |
624 | * on a request handle if a response is already served for it. | 644 | * on a request handle if a response is already served for it. |
625 | * | 645 | * |