fixing #5767
This commit is contained in:
parent
fbf94ee666
commit
5b2efa2b06
@ -189,7 +189,6 @@ verify_signatures (const struct GNUNET_HashCode *h_wire,
|
||||
TALER_LOG_DEBUG ("... amount_without_fee was %s\n",
|
||||
TALER_amount2s (amount_without_fee));
|
||||
}
|
||||
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
sv.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
|
||||
@ -360,9 +359,9 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor,
|
||||
"URL for deposit-confirmation: `%s'\n",
|
||||
dh->url);
|
||||
ctx = MAH_handle_to_context (auditor);
|
||||
dh->job = GNUNET_CURL_job_add (ctx,
|
||||
dh->job = GNUNET_CURL_job_add2 (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
dh->ctx.headers,
|
||||
&handle_deposit_confirmation_finished,
|
||||
dh);
|
||||
return dh;
|
||||
|
@ -385,8 +385,9 @@ int
|
||||
MAH_handle_is_ready (struct TALER_AUDITOR_Handle *h)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Checking if auditor %p is now ready: %s\n",
|
||||
"Checking if auditor %p (%s) is now ready: %s\n",
|
||||
h,
|
||||
h->url,
|
||||
(MHD_VERSION == h->state) ? "yes" : "no");
|
||||
return (MHS_VERSION == h->state) ? GNUNET_YES : GNUNET_NO;
|
||||
}
|
||||
@ -459,9 +460,6 @@ TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx,
|
||||
{
|
||||
struct TALER_AUDITOR_Handle *auditor;
|
||||
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Connecting to auditor at URL `%s'.\n",
|
||||
url);
|
||||
/* Disable 100 continue processing */
|
||||
GNUNET_break (GNUNET_OK ==
|
||||
GNUNET_CURL_append_header (ctx,
|
||||
@ -473,6 +471,10 @@ TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx,
|
||||
auditor->version_cb_cls = version_cb_cls;
|
||||
auditor->retry_task = GNUNET_SCHEDULER_add_now (&request_version,
|
||||
auditor);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Connecting to auditor at URL `%s' (%p).\n",
|
||||
url,
|
||||
auditor);
|
||||
return auditor;
|
||||
}
|
||||
|
||||
@ -520,6 +522,10 @@ request_version (void *cls)
|
||||
void
|
||||
TALER_AUDITOR_disconnect (struct TALER_AUDITOR_Handle *auditor)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Disconnecting from auditor at URL `%s' (%p).\n",
|
||||
auditor->url,
|
||||
auditor);
|
||||
if (NULL != auditor->vr)
|
||||
{
|
||||
GNUNET_CURL_job_cancel (auditor->vr->job);
|
||||
|
@ -31,8 +31,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* Add the @a body as POST data to the easy handle in
|
||||
* @a ctx.
|
||||
* Add the @a body as POST data to the easy handle in @a ctx.
|
||||
*
|
||||
* @param ctx[in,out] a request context (updated)
|
||||
* @param eh easy handle to use
|
||||
|
@ -555,47 +555,38 @@ run (void *cls,
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-2",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-3",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-4",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-5",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-6",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-7",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-8",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-9",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
|
||||
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-10",
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
@ -710,6 +701,12 @@ run (void *cls,
|
||||
GNUNET_TIME_UNIT_ZERO,
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_deposit_confirmation ("deposit-confirmation",
|
||||
is->auditor,
|
||||
"massive-deposit-10",
|
||||
0,
|
||||
"EUR:0.99",
|
||||
MHD_HTTP_OK),
|
||||
CMD_RUN_AUDITOR("massive-auditor"),
|
||||
|
||||
TALER_TESTING_cmd_end ()
|
||||
@ -752,7 +749,6 @@ int
|
||||
main (int argc,
|
||||
char * const *argv)
|
||||
{
|
||||
|
||||
/* These environment variables get in the way... */
|
||||
unsetenv ("XDG_DATA_HOME");
|
||||
unsetenv ("XDG_CONFIG_HOME");
|
||||
|
@ -66,10 +66,9 @@ struct DepositState
|
||||
json_t *contract_terms;
|
||||
|
||||
/**
|
||||
* Relative time (to add to 'now') to compute the refund
|
||||
* deadline. Zero for no refunds.
|
||||
* Refund deadline. Zero for no refunds.
|
||||
*/
|
||||
struct GNUNET_TIME_Relative refund_deadline;
|
||||
struct GNUNET_TIME_Absolute refund_deadline;
|
||||
|
||||
/**
|
||||
* Set (by the interpreter) to a fresh private key. This
|
||||
@ -82,6 +81,11 @@ struct DepositState
|
||||
*/
|
||||
struct TALER_EXCHANGE_DepositHandle *dh;
|
||||
|
||||
/**
|
||||
* Timestamp of the /deposit operation.
|
||||
*/
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
|
||||
/**
|
||||
* Interpreter state.
|
||||
*/
|
||||
@ -245,9 +249,7 @@ 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 refund_deadline;
|
||||
struct GNUNET_TIME_Absolute wire_deadline;
|
||||
struct GNUNET_TIME_Absolute timestamp;
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv;
|
||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||
struct GNUNET_HashCode h_contract_terms;
|
||||
@ -307,17 +309,17 @@ deposit_run (void *cls,
|
||||
ds->merchant_priv.eddsa_priv = *merchant_priv;
|
||||
GNUNET_free (merchant_priv);
|
||||
|
||||
if (0 != ds->refund_deadline.rel_value_us)
|
||||
if (0 != ds->refund_deadline.abs_value_us)
|
||||
{
|
||||
refund_deadline = GNUNET_TIME_relative_to_absolute
|
||||
(ds->refund_deadline);
|
||||
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
|
||||
(ds->refund_deadline, 2));
|
||||
(GNUNET_TIME_relative_multiply (refund_deadline, 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
refund_deadline = GNUNET_TIME_UNIT_ZERO_ABS;
|
||||
ds->refund_deadline = ds->timestamp;
|
||||
wire_deadline = GNUNET_TIME_relative_to_absolute
|
||||
(GNUNET_TIME_UNIT_ZERO);
|
||||
}
|
||||
@ -325,10 +327,7 @@ deposit_run (void *cls,
|
||||
(&ds->merchant_priv.eddsa_priv,
|
||||
&merchant_pub.eddsa_pub);
|
||||
|
||||
timestamp = GNUNET_TIME_absolute_get ();
|
||||
GNUNET_TIME_round_abs (×tamp);
|
||||
GNUNET_TIME_round_abs (&refund_deadline);
|
||||
GNUNET_TIME_round_abs (&wire_deadline);
|
||||
(void) GNUNET_TIME_round_abs (&wire_deadline);
|
||||
|
||||
{
|
||||
struct TALER_DepositRequestPS dr;
|
||||
@ -343,9 +342,9 @@ deposit_run (void *cls,
|
||||
(GNUNET_OK ==
|
||||
TALER_JSON_merchant_wire_signature_hash (ds->wire_details,
|
||||
&dr.h_wire));
|
||||
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
|
||||
dr.timestamp = GNUNET_TIME_absolute_hton (ds->timestamp);
|
||||
dr.refund_deadline = GNUNET_TIME_absolute_hton
|
||||
(refund_deadline);
|
||||
(ds->refund_deadline);
|
||||
TALER_amount_hton (&dr.amount_with_fee, &amount);
|
||||
TALER_amount_hton
|
||||
(&dr.deposit_fee, &denom_pub->fee_deposit);
|
||||
@ -365,9 +364,9 @@ deposit_run (void *cls,
|
||||
&coin_pub,
|
||||
denom_pub_sig,
|
||||
&denom_pub->key,
|
||||
timestamp,
|
||||
ds->timestamp,
|
||||
&merchant_pub,
|
||||
refund_deadline,
|
||||
ds->refund_deadline,
|
||||
&coin_sig,
|
||||
&deposit_cb,
|
||||
ds);
|
||||
@ -537,8 +536,20 @@ TALER_TESTING_cmd_deposit
|
||||
label);
|
||||
GNUNET_assert (0);
|
||||
}
|
||||
ds->timestamp = GNUNET_TIME_absolute_get ();
|
||||
(void) GNUNET_TIME_round_abs (&ds->timestamp);
|
||||
|
||||
ds->refund_deadline = refund_deadline;
|
||||
json_object_set (ds->contract_terms,
|
||||
"timestamp",
|
||||
GNUNET_JSON_from_time_abs (ds->timestamp));
|
||||
if (0 != refund_deadline.rel_value_us)
|
||||
{
|
||||
ds->refund_deadline = GNUNET_TIME_relative_to_absolute (refund_deadline);
|
||||
(void) GNUNET_TIME_round_abs (&ds->refund_deadline);
|
||||
json_object_set (ds->contract_terms,
|
||||
"refund_deadline",
|
||||
GNUNET_JSON_from_time_abs (ds->refund_deadline));
|
||||
}
|
||||
ds->amount = amount;
|
||||
ds->expected_response_code = expected_response_code;
|
||||
|
||||
|
@ -246,7 +246,7 @@ deposit_confirmation_run (void *cls,
|
||||
dcs->coin_index,
|
||||
&wire_details));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (wire_details,
|
||||
TALER_JSON_merchant_wire_signature_hash (wire_details,
|
||||
&h_wire));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_TESTING_get_trait_coin_priv (deposit_cmd,
|
||||
@ -263,10 +263,10 @@ deposit_confirmation_run (void *cls,
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (dcs->amount_without_fee,
|
||||
&amount_without_fee));
|
||||
/* timestamp is mandatory */
|
||||
{
|
||||
struct GNUNET_JSON_Specification spec[] = {
|
||||
GNUNET_JSON_spec_absolute_time ("timestamp", ×tamp),
|
||||
GNUNET_JSON_spec_absolute_time ("refund_deadline", &refund_deadline),
|
||||
GNUNET_JSON_spec_end()
|
||||
};
|
||||
|
||||
@ -280,6 +280,21 @@ deposit_confirmation_run (void *cls,
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* refund deadline is optional, defaults to zero */
|
||||
{
|
||||
struct GNUNET_JSON_Specification spec[] = {
|
||||
GNUNET_JSON_spec_absolute_time ("refund_deadline", &refund_deadline),
|
||||
GNUNET_JSON_spec_end()
|
||||
};
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_JSON_parse (contract_terms,
|
||||
spec,
|
||||
NULL, NULL))
|
||||
{
|
||||
refund_deadline = timestamp;
|
||||
}
|
||||
}
|
||||
dcs->dc = TALER_AUDITOR_deposit_confirmation
|
||||
(dcs->auditor,
|
||||
&h_wire,
|
||||
|
Loading…
Reference in New Issue
Block a user