add withdraw proof to reserve history json

This commit is contained in:
Christian Grothoff 2015-03-09 13:04:51 +01:00
parent f2700dc6ee
commit e4e8fe6c7c
3 changed files with 25 additions and 3 deletions

View File

@ -182,9 +182,15 @@ struct CollectableBlindcoin
*/
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub;
/**
* Hash over the blinded message, needed to verify
* the @e reserve_sig.
*/
struct GNUNET_HashCode h_coin_envelope;
/**
* Signature confirming the withdrawl, matching @e reserve_pub,
* @e denom_pub and @e h_blind.
* @e denom_pub and @e h_coin_envelope.
*/
struct GNUNET_CRYPTO_EddsaSignature reserve_sig;
};

View File

@ -378,9 +378,12 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
return TALER_MINT_reply_internal_error (connection,
"Internal error");
}
collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
collectable.sig = sig;
collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
collectable.reserve_pub = *reserve;
GNUNET_CRYPTO_hash (blinded_msg,
blinded_msg_len,
&collectable.h_coin_envelope);
collectable.reserve_sig = *signature;
if (GNUNET_OK !=
TALER_MINT_DB_insert_collectable_blindcoin (db_conn,

View File

@ -418,10 +418,12 @@ compile_reserve_history (const struct ReserveHistory *rh,
struct TALER_Amount withdraw_total;
struct TALER_Amount value;
json_t *json_history;
json_t *transaction;
int ret;
const struct ReserveHistory *pos;
struct TALER_MINT_DenomKeyIssuePriv *dki;
struct MintKeyState *key_state;
struct TALER_WithdrawRequest wr;
json_history = json_array ();
ret = 0;
@ -456,6 +458,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
case TALER_MINT_DB_RO_BANK_TO_MINT:
break;
case TALER_MINT_DB_RO_WITHDRAW_COIN:
dki = TALER_MINT_get_denom_key (key_state,
pos->details.withdraw->denom_pub);
value = TALER_amount_ntoh (dki->issue.value);
@ -465,10 +468,20 @@ compile_reserve_history (const struct ReserveHistory *rh,
withdraw_total = TALER_amount_add (withdraw_total,
value);
ret = 1;
/* FIXME: add `struct CollectableBlindcoin` as JSON here as well! (#3527) */
wr.purpose.purpose = htonl (TALER_SIGNATURE_WITHDRAW);
wr.purpose.size = htonl (sizeof (struct TALER_WithdrawRequest));
wr.reserve_pub = pos->details.withdraw->reserve_pub;
GNUNET_CRYPTO_rsa_public_key_hash (pos->details.withdraw->denom_pub,
&wr.h_denomination_pub);
wr.h_coin_envelope = pos->details.withdraw->h_coin_envelope;
transaction = TALER_JSON_from_eddsa_sig (&wr.purpose,
&pos->details.withdraw->reserve_sig);
json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o}",
"type", "WITHDRAW",
"signature", transaction,
"amount", TALER_JSON_from_amount (value)));
break;