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