add withdraw proof to reserve history json
This commit is contained in:
parent
f2700dc6ee
commit
e4e8fe6c7c
@ -182,9 +182,15 @@ struct CollectableBlindcoin
|
|||||||
*/
|
*/
|
||||||
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub;
|
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,
|
* 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;
|
struct GNUNET_CRYPTO_EddsaSignature reserve_sig;
|
||||||
};
|
};
|
||||||
|
@ -378,9 +378,12 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
|
|||||||
return TALER_MINT_reply_internal_error (connection,
|
return TALER_MINT_reply_internal_error (connection,
|
||||||
"Internal error");
|
"Internal error");
|
||||||
}
|
}
|
||||||
collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
|
|
||||||
collectable.sig = sig;
|
collectable.sig = sig;
|
||||||
|
collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
|
||||||
collectable.reserve_pub = *reserve;
|
collectable.reserve_pub = *reserve;
|
||||||
|
GNUNET_CRYPTO_hash (blinded_msg,
|
||||||
|
blinded_msg_len,
|
||||||
|
&collectable.h_coin_envelope);
|
||||||
collectable.reserve_sig = *signature;
|
collectable.reserve_sig = *signature;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_MINT_DB_insert_collectable_blindcoin (db_conn,
|
TALER_MINT_DB_insert_collectable_blindcoin (db_conn,
|
||||||
|
@ -418,10 +418,12 @@ compile_reserve_history (const struct ReserveHistory *rh,
|
|||||||
struct TALER_Amount withdraw_total;
|
struct TALER_Amount withdraw_total;
|
||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
json_t *json_history;
|
json_t *json_history;
|
||||||
|
json_t *transaction;
|
||||||
int ret;
|
int ret;
|
||||||
const struct ReserveHistory *pos;
|
const struct ReserveHistory *pos;
|
||||||
struct TALER_MINT_DenomKeyIssuePriv *dki;
|
struct TALER_MINT_DenomKeyIssuePriv *dki;
|
||||||
struct MintKeyState *key_state;
|
struct MintKeyState *key_state;
|
||||||
|
struct TALER_WithdrawRequest wr;
|
||||||
|
|
||||||
json_history = json_array ();
|
json_history = json_array ();
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -456,6 +458,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
|
|||||||
case TALER_MINT_DB_RO_BANK_TO_MINT:
|
case TALER_MINT_DB_RO_BANK_TO_MINT:
|
||||||
break;
|
break;
|
||||||
case TALER_MINT_DB_RO_WITHDRAW_COIN:
|
case TALER_MINT_DB_RO_WITHDRAW_COIN:
|
||||||
|
|
||||||
dki = TALER_MINT_get_denom_key (key_state,
|
dki = TALER_MINT_get_denom_key (key_state,
|
||||||
pos->details.withdraw->denom_pub);
|
pos->details.withdraw->denom_pub);
|
||||||
value = TALER_amount_ntoh (dki->issue.value);
|
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,
|
withdraw_total = TALER_amount_add (withdraw_total,
|
||||||
value);
|
value);
|
||||||
ret = 1;
|
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_array_append_new (json_history,
|
||||||
json_pack ("{s:s, s:o, s:o}",
|
json_pack ("{s:s, s:o, s:o}",
|
||||||
"type", "WITHDRAW",
|
"type", "WITHDRAW",
|
||||||
|
"signature", transaction,
|
||||||
"amount", TALER_JSON_from_amount (value)));
|
"amount", TALER_JSON_from_amount (value)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user