more work towards testing deposit confirmations
This commit is contained in:
parent
4d058c4eb7
commit
cf1ce47863
@ -191,17 +191,15 @@ deposit_confirmation_run (void *cls,
|
|||||||
struct GNUNET_TIME_Absolute timestamp;
|
struct GNUNET_TIME_Absolute timestamp;
|
||||||
struct GNUNET_TIME_Absolute refund_deadline;
|
struct GNUNET_TIME_Absolute refund_deadline;
|
||||||
const struct TALER_Amount *amount_without_fee;
|
const struct TALER_Amount *amount_without_fee;
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
const struct TALER_MerchantPublicKeyP *merchant_pub;
|
const struct TALER_MerchantPublicKeyP *merchant_pub;
|
||||||
const struct TALER_ExchangePublicKeyP *exchange_pub;
|
const struct TALER_ExchangePublicKeyP *exchange_pub;
|
||||||
const struct TALER_ExchangeSignatureP *exchange_sig;
|
const struct TALER_ExchangeSignatureP *exchange_sig;
|
||||||
const struct TALER_MasterPublicKeyP *master_pub;
|
|
||||||
struct GNUNET_TIME_Absolute ep_start;
|
|
||||||
struct GNUNET_TIME_Absolute ep_expire;
|
|
||||||
struct GNUNET_TIME_Absolute ep_end;
|
|
||||||
const struct TALER_MasterSignatureP *master_sig;
|
|
||||||
const json_t *wire_details;
|
const json_t *wire_details;
|
||||||
const json_t *contract_terms;
|
const json_t *contract_terms;
|
||||||
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
|
const struct TALER_EXCHANGE_Keys *keys;
|
||||||
|
const struct TALER_EXCHANGE_SigningPublicKey *spk;
|
||||||
|
|
||||||
dcs->is = is;
|
dcs->is = is;
|
||||||
this_cmd = &is->commands[is->ip]; // use this_cmd->label for logging!
|
this_cmd = &is->commands[is->ip]; // use this_cmd->label for logging!
|
||||||
@ -225,6 +223,10 @@ deposit_confirmation_run (void *cls,
|
|||||||
TALER_TESTING_get_trait_exchange_sig (deposit_cmd,
|
TALER_TESTING_get_trait_exchange_sig (deposit_cmd,
|
||||||
dcs->coin_index,
|
dcs->coin_index,
|
||||||
&exchange_sig));
|
&exchange_sig));
|
||||||
|
keys = TALER_EXCHANGE_get_keys (dcs->is->exchange);
|
||||||
|
GNUNET_assert (NULL != keys);
|
||||||
|
spk = TALER_EXCHANGE_get_exchange_signing_key_info (keys,
|
||||||
|
exchange_pub);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
@ -241,15 +243,12 @@ deposit_confirmation_run (void *cls,
|
|||||||
TALER_JSON_hash (wire_details,
|
TALER_JSON_hash (wire_details,
|
||||||
&h_wire);
|
&h_wire);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// FIXME: extract from deposit trait!
|
|
||||||
/* Fixme: do prefer "interpreter fail" over assertions,
|
|
||||||
* as the former takes care of shutting down processes, too */
|
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_TESTING_get_trait_coin_priv (deposit_cmd,
|
TALER_TESTING_get_trait_coin_priv (deposit_cmd,
|
||||||
ds->coin_index,
|
dcs->coin_index,
|
||||||
&coin_priv));
|
&coin_priv));
|
||||||
#endif
|
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
|
||||||
|
&coin_pub.eddsa_pub);
|
||||||
|
|
||||||
dcs->dc = TALER_AUDITOR_deposit_confirmation
|
dcs->dc = TALER_AUDITOR_deposit_confirmation
|
||||||
(dcs->auditor,
|
(dcs->auditor,
|
||||||
@ -258,15 +257,15 @@ deposit_confirmation_run (void *cls,
|
|||||||
timestamp,
|
timestamp,
|
||||||
refund_deadline,
|
refund_deadline,
|
||||||
amount_without_fee,
|
amount_without_fee,
|
||||||
coin_pub,
|
&coin_pub,
|
||||||
merchant_pub,
|
merchant_pub,
|
||||||
exchange_pub,
|
exchange_pub,
|
||||||
exchange_sig,
|
exchange_sig,
|
||||||
master_pub,
|
&keys->master_pub,
|
||||||
ep_start,
|
spk->valid_from,
|
||||||
ep_expire,
|
spk->valid_until,
|
||||||
ep_end,
|
spk->valid_legal,
|
||||||
master_sig,
|
&spk->master_sig,
|
||||||
&deposit_confirmation_cb,
|
&deposit_confirmation_cb,
|
||||||
dcs);
|
dcs);
|
||||||
|
|
||||||
|
@ -325,4 +325,29 @@ TALER_EXCHANGE_verify_coin_history (const char *currency,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain meta data about an exchange (online) signing
|
||||||
|
* key.
|
||||||
|
*
|
||||||
|
* @param keys from where to obtain the meta data
|
||||||
|
* @param exchange_pub public key to lookup
|
||||||
|
* @return NULL on error (@a exchange_pub not known)
|
||||||
|
*/
|
||||||
|
const struct TALER_EXCHANGE_SigningPublicKey *
|
||||||
|
TALER_EXCHANGE_get_exchange_signing_key_info (const struct TALER_EXCHANGE_Keys *keys,
|
||||||
|
const struct TALER_ExchangePublicKeyP *exchange_pub)
|
||||||
|
{
|
||||||
|
for (unsigned int i=0;i<keys->num_sign_keys;i++)
|
||||||
|
{
|
||||||
|
const struct TALER_EXCHANGE_SigningPublicKey *spk;
|
||||||
|
|
||||||
|
spk = &keys->sign_keys[i];
|
||||||
|
if (0 == memcmp (exchange_pub,
|
||||||
|
&spk->key,
|
||||||
|
sizeof (struct TALER_ExchangePublicKeyP)))
|
||||||
|
return spk;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* end of exchange_api_common.c */
|
/* end of exchange_api_common.c */
|
||||||
|
@ -246,7 +246,7 @@ deposit_run (void *cls,
|
|||||||
struct DepositState *ds = cls;
|
struct DepositState *ds = cls;
|
||||||
const struct TALER_TESTING_Command *coin_cmd;
|
const struct TALER_TESTING_Command *coin_cmd;
|
||||||
struct TALER_TESTING_Command *this_cmd;
|
struct TALER_TESTING_Command *this_cmd;
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
|
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
|
||||||
struct TALER_DenominationSignature *denom_pub_sig;
|
struct TALER_DenominationSignature *denom_pub_sig;
|
||||||
@ -450,7 +450,7 @@ deposit_traits (void *cls,
|
|||||||
struct DepositState *ds = cls;
|
struct DepositState *ds = cls;
|
||||||
const struct TALER_TESTING_Command *coin_cmd;
|
const struct TALER_TESTING_Command *coin_cmd;
|
||||||
/* Will point to coin cmd internals. */
|
/* Will point to coin cmd internals. */
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_spent_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_spent_priv;
|
||||||
|
|
||||||
coin_cmd = TALER_TESTING_interpreter_lookup_command
|
coin_cmd = TALER_TESTING_interpreter_lookup_command
|
||||||
(ds->is,
|
(ds->is,
|
||||||
|
@ -224,7 +224,7 @@ payback_run (void *cls,
|
|||||||
{
|
{
|
||||||
struct PaybackState *ps = cls;
|
struct PaybackState *ps = cls;
|
||||||
const struct TALER_TESTING_Command *coin_cmd;
|
const struct TALER_TESTING_Command *coin_cmd;
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
struct TALER_DenominationBlindingKeyP *blinding_key;
|
struct TALER_DenominationBlindingKeyP *blinding_key;
|
||||||
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
|
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
|
||||||
struct TALER_DenominationSignature *coin_sig;
|
struct TALER_DenominationSignature *coin_sig;
|
||||||
|
@ -715,7 +715,7 @@ refresh_link_run (void *cls,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv
|
if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv
|
||||||
(coin_cmd, 0, &coin_priv))
|
(coin_cmd, 0, &coin_priv))
|
||||||
{
|
{
|
||||||
@ -903,7 +903,7 @@ refresh_melt_run (void *cls,
|
|||||||
(num_fresh_coins,
|
(num_fresh_coins,
|
||||||
struct TALER_EXCHANGE_DenomPublicKey);
|
struct TALER_EXCHANGE_DenomPublicKey);
|
||||||
{
|
{
|
||||||
struct TALER_CoinSpendPrivateKeyP *melt_priv;
|
const struct TALER_CoinSpendPrivateKeyP *melt_priv;
|
||||||
struct TALER_Amount melt_amount;
|
struct TALER_Amount melt_amount;
|
||||||
struct TALER_Amount fresh_amount;
|
struct TALER_Amount fresh_amount;
|
||||||
struct TALER_DenominationSignature *melt_sig;
|
struct TALER_DenominationSignature *melt_sig;
|
||||||
|
@ -143,7 +143,7 @@ refund_run (void *cls,
|
|||||||
struct TALER_TESTING_Interpreter *is)
|
struct TALER_TESTING_Interpreter *is)
|
||||||
{
|
{
|
||||||
struct RefundState *rs = cls;
|
struct RefundState *rs = cls;
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
struct TALER_CoinSpendPublicKeyP coin;
|
struct TALER_CoinSpendPublicKeyP coin;
|
||||||
const char *contract_terms;
|
const char *contract_terms;
|
||||||
struct GNUNET_HashCode h_contract_terms;
|
struct GNUNET_HashCode h_contract_terms;
|
||||||
|
@ -259,14 +259,14 @@ deposit_wtid_cb
|
|||||||
* @param cmd the command to execute.
|
* @param cmd the command to execute.
|
||||||
* @param is the interpreter state.
|
* @param is the interpreter state.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
track_transaction_run (void *cls,
|
track_transaction_run (void *cls,
|
||||||
const struct TALER_TESTING_Command *cmd,
|
const struct TALER_TESTING_Command *cmd,
|
||||||
struct TALER_TESTING_Interpreter *is)
|
struct TALER_TESTING_Interpreter *is)
|
||||||
{
|
{
|
||||||
struct TrackTransactionState *tts = cls;
|
struct TrackTransactionState *tts = cls;
|
||||||
const struct TALER_TESTING_Command *transaction_cmd;
|
const struct TALER_TESTING_Command *transaction_cmd;
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
const char *contract_terms;
|
const char *contract_terms;
|
||||||
const json_t *wire_details;
|
const json_t *wire_details;
|
||||||
|
@ -46,7 +46,7 @@ int
|
|||||||
TALER_TESTING_get_trait_coin_priv
|
TALER_TESTING_get_trait_coin_priv
|
||||||
(const struct TALER_TESTING_Command *cmd,
|
(const struct TALER_TESTING_Command *cmd,
|
||||||
unsigned int index,
|
unsigned int index,
|
||||||
struct TALER_CoinSpendPrivateKeyP **coin_priv)
|
const struct TALER_CoinSpendPrivateKeyP **coin_priv)
|
||||||
{
|
{
|
||||||
return cmd->traits (cmd->cls,
|
return cmd->traits (cmd->cls,
|
||||||
(void **) coin_priv,
|
(void **) coin_priv,
|
||||||
|
@ -484,6 +484,19 @@ TALER_EXCHANGE_get_denomination_key_by_hash (const struct TALER_EXCHANGE_Keys *k
|
|||||||
const struct GNUNET_HashCode *hc);
|
const struct GNUNET_HashCode *hc);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain meta data about an exchange (online) signing
|
||||||
|
* key.
|
||||||
|
*
|
||||||
|
* @param keys from where to obtain the meta data
|
||||||
|
* @param exchange_pub public key to lookup
|
||||||
|
* @return NULL on error (@a exchange_pub not known)
|
||||||
|
*/
|
||||||
|
const struct TALER_EXCHANGE_SigningPublicKey *
|
||||||
|
TALER_EXCHANGE_get_exchange_signing_key_info (const struct TALER_EXCHANGE_Keys *keys,
|
||||||
|
const struct TALER_ExchangePublicKeyP *exchange_pub);
|
||||||
|
|
||||||
|
|
||||||
/* ********************* /wire *********************** */
|
/* ********************* /wire *********************** */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1656,7 +1656,7 @@ int
|
|||||||
TALER_TESTING_get_trait_coin_priv
|
TALER_TESTING_get_trait_coin_priv
|
||||||
(const struct TALER_TESTING_Command *cmd,
|
(const struct TALER_TESTING_Command *cmd,
|
||||||
unsigned int index,
|
unsigned int index,
|
||||||
struct TALER_CoinSpendPrivateKeyP **coin_priv);
|
const struct TALER_CoinSpendPrivateKeyP **coin_priv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer blinding key.
|
* Offer blinding key.
|
||||||
|
Loading…
Reference in New Issue
Block a user