diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-06 19:43:47 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-06 19:43:47 +0100 |
commit | 9d6e1040669435dfa2ab93abd4f1669c7bf90871 (patch) | |
tree | c072a1284e6b3da14f972d98197d22f4d14500d5 /src/testing | |
parent | 57acad487de0ecb3f964c83a60e4f2d7d1ec460b (diff) | |
download | exchange-9d6e1040669435dfa2ab93abd4f1669c7bf90871.tar.xz |
include h_extensions in deposit confirmation
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing_api_cmd_auditor_deposit_confirmation.c | 9 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_deposit.c | 27 |
2 files changed, 28 insertions, 8 deletions
diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c index 6522fe5bf..12496e0e9 100644 --- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c +++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c @@ -205,6 +205,7 @@ deposit_confirmation_run (void *cls, struct TALER_PrivateContractHash h_contract_terms; const struct GNUNET_TIME_Absolute *exchange_timestamp = NULL; struct GNUNET_TIME_Absolute timestamp; + const struct GNUNET_TIME_Absolute *wire_deadline; struct GNUNET_TIME_Absolute refund_deadline; struct TALER_Amount amount_without_fee; struct TALER_CoinSpendPublicKeyP coin_pub; @@ -243,6 +244,10 @@ deposit_confirmation_run (void *cls, TALER_TESTING_get_trait_absolute_time (deposit_cmd, dcs->coin_index, &exchange_timestamp)); + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_wire_deadline (deposit_cmd, + dcs->coin_index, + &wire_deadline)); GNUNET_assert (NULL != exchange_timestamp); keys = TALER_EXCHANGE_get_keys (dcs->is->exchange); GNUNET_assert (NULL != keys); @@ -297,7 +302,8 @@ deposit_confirmation_run (void *cls, /* refund deadline is optional, defaults to zero */ { struct GNUNET_JSON_Specification spec[] = { - TALER_JSON_spec_absolute_time ("refund_deadline", &refund_deadline), + TALER_JSON_spec_absolute_time ("refund_deadline", + &refund_deadline), GNUNET_JSON_spec_end () }; @@ -313,6 +319,7 @@ deposit_confirmation_run (void *cls, &h_wire, &h_contract_terms, *exchange_timestamp, + *wire_deadline, refund_deadline, &amount_without_fee, &coin_pub, diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c index 9d2e15b79..29b2ce64a 100644 --- a/src/testing/testing_api_cmd_deposit.c +++ b/src/testing/testing_api_cmd_deposit.c @@ -85,6 +85,11 @@ struct DepositState struct GNUNET_TIME_Absolute refund_deadline; /** + * Wire deadline. + */ + struct GNUNET_TIME_Absolute wire_deadline; + + /** * Set (by the interpreter) to a fresh private key. This * key will be used to sign the deposit request. */ @@ -285,7 +290,6 @@ deposit_run (void *cls, const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; const struct TALER_DenominationSignature *denom_pub_sig; struct TALER_CoinSpendSignatureP coin_sig; - struct GNUNET_TIME_Absolute wire_deadline; struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_PrivateContractHash h_contract_terms; enum TALER_ErrorCode ec; @@ -402,18 +406,23 @@ deposit_run (void *cls, { struct GNUNET_TIME_Relative refund_deadline; - refund_deadline = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline); - wire_deadline = GNUNET_TIME_relative_to_absolute - (GNUNET_TIME_relative_multiply (refund_deadline, 2)); + refund_deadline + = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline); + ds->wire_deadline + = GNUNET_TIME_relative_to_absolute ( + GNUNET_TIME_relative_multiply (refund_deadline, + 2)); } else { ds->refund_deadline = ds->wallet_timestamp; - wire_deadline = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_ZERO); + ds->wire_deadline + = GNUNET_TIME_relative_to_absolute ( + GNUNET_TIME_UNIT_ZERO); } GNUNET_CRYPTO_eddsa_key_get_public (&ds->merchant_priv.eddsa_priv, &merchant_pub.eddsa_pub); - (void) GNUNET_TIME_round_abs (&wire_deadline); + (void) GNUNET_TIME_round_abs (&ds->wire_deadline); { struct TALER_MerchantWireHash h_wire; @@ -434,7 +443,7 @@ deposit_run (void *cls, } ds->dh = TALER_EXCHANGE_deposit (is->exchange, &ds->amount, - wire_deadline, + ds->wire_deadline, payto_uri, &wire_salt, &h_contract_terms, @@ -555,6 +564,10 @@ deposit_traits (void *cls, TALER_TESTING_make_trait_deposit_fee_amount (&ds->deposit_fee), TALER_TESTING_make_trait_absolute_time (0, &ds->exchange_timestamp), + TALER_TESTING_make_trait_wire_deadline (0, + &ds->wire_deadline), + TALER_TESTING_make_trait_refund_deadline (0, + &ds->refund_deadline), TALER_TESTING_trait_end () }; |