-make econtract optional as per design

This commit is contained in:
Christian Grothoff 2022-06-23 23:09:45 +02:00 committed by Özgür Kesim
parent 31f74059e0
commit ce515a1f75
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7

View File

@ -135,6 +135,12 @@ struct PurseCreateContext
* Minimum age for deposits into this purse. * Minimum age for deposits into this purse.
*/ */
uint32_t min_age; uint32_t min_age;
/**
* Do we have an @e econtract?
*/
bool no_econtract;
}; };
@ -370,6 +376,8 @@ create_transaction (void *cls,
} }
} }
/* 3) if present, persist contract */ /* 3) if present, persist contract */
if (! pcc->no_econtract)
{
in_conflict = true; in_conflict = true;
qs = TEH_plugin->insert_contract (TEH_plugin->cls, qs = TEH_plugin->insert_contract (TEH_plugin->cls,
pcc->purse_pub, pcc->purse_pub,
@ -426,6 +434,7 @@ create_transaction (void *cls,
GNUNET_free (econtract.econtract); GNUNET_free (econtract.econtract);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
}
return qs; return qs;
} }
@ -664,7 +673,6 @@ TEH_handler_purses_create (
json_t *deposits; json_t *deposits;
json_t *deposit; json_t *deposit;
unsigned int idx; unsigned int idx;
bool no_econtract = true;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount ("amount", TALER_JSON_spec_amount ("amount",
TEH_currency, TEH_currency,
@ -674,7 +682,7 @@ TEH_handler_purses_create (
GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_econtract ("econtract", TALER_JSON_spec_econtract ("econtract",
&pcc.econtract), &pcc.econtract),
&no_econtract), &pcc.no_econtract),
GNUNET_JSON_spec_fixed_auto ("merge_pub", GNUNET_JSON_spec_fixed_auto ("merge_pub",
&pcc.merge_pub), &pcc.merge_pub),
GNUNET_JSON_spec_fixed_auto ("purse_sig", GNUNET_JSON_spec_fixed_auto ("purse_sig",
@ -815,7 +823,7 @@ TEH_handler_purses_create (
TALER_EC_EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID, TALER_EC_EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID,
NULL); NULL);
} }
if ( (! no_econtract) && if ( (! pcc.no_econtract) &&
(GNUNET_OK != (GNUNET_OK !=
TALER_wallet_econtract_upload_verify (pcc.econtract.econtract, TALER_wallet_econtract_upload_verify (pcc.econtract.econtract,
pcc.econtract.econtract_size, pcc.econtract.econtract_size,