Merge branch 'master' of git.taler.net:/var/git/exchange
This commit is contained in:
commit
6b615dcd95
@ -406,42 +406,21 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
|
|
||||||
(void) GNUNET_TIME_round_abs (&wire_deadline);
|
(void) GNUNET_TIME_round_abs (&wire_deadline);
|
||||||
(void) GNUNET_TIME_round_abs (&refund_deadline);
|
(void) GNUNET_TIME_round_abs (&refund_deadline);
|
||||||
if (refund_deadline.abs_value_us > wire_deadline.abs_value_us)
|
GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us);
|
||||||
{
|
GNUNET_assert (GNUNET_YES ==
|
||||||
GNUNET_break (0);
|
MAH_handle_is_ready (exchange));
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (GNUNET_YES !=
|
|
||||||
MAH_handle_is_ready (exchange))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
/* initialize h_wire */
|
/* initialize h_wire */
|
||||||
if (GNUNET_OK !=
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_JSON_hash (wire_details,
|
TALER_JSON_hash (wire_details,
|
||||||
&h_wire))
|
&h_wire));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
key_state = TALER_EXCHANGE_get_keys (exchange);
|
key_state = TALER_EXCHANGE_get_keys (exchange);
|
||||||
dki = TALER_EXCHANGE_get_denomination_key (key_state,
|
dki = TALER_EXCHANGE_get_denomination_key (key_state,
|
||||||
denom_pub);
|
denom_pub);
|
||||||
if (NULL == dki)
|
GNUNET_assert (NULL != dki);
|
||||||
{
|
GNUNET_assert (GNUNET_SYSERR !=
|
||||||
TALER_LOG_WARNING ("Denomination key unknown to exchange\n");
|
TALER_amount_subtract (&amount_without_fee,
|
||||||
return NULL;
|
amount,
|
||||||
}
|
&dki->fee_deposit));
|
||||||
if (GNUNET_SYSERR ==
|
|
||||||
TALER_amount_subtract (&amount_without_fee,
|
|
||||||
amount,
|
|
||||||
&dki->fee_deposit))
|
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
verify_signatures (dki,
|
verify_signatures (dki,
|
||||||
amount,
|
amount,
|
||||||
@ -523,10 +502,10 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
strlen (dh->json_enc)));
|
strlen (dh->json_enc)));
|
||||||
ctx = MAH_handle_to_context (exchange);
|
ctx = MAH_handle_to_context (exchange);
|
||||||
dh->job = GNUNET_CURL_job_add (ctx,
|
dh->job = GNUNET_CURL_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
GNUNET_YES,
|
GNUNET_YES,
|
||||||
&handle_deposit_finished,
|
&handle_deposit_finished,
|
||||||
dh);
|
dh);
|
||||||
return dh;
|
return dh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,12 +1277,8 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
if (GNUNET_YES !=
|
GNUNET_assert (GNUNET_YES ==
|
||||||
MAH_handle_is_ready (exchange))
|
MAH_handle_is_ready (exchange));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
md = deserialize_melt_data (refresh_data,
|
md = deserialize_melt_data (refresh_data,
|
||||||
refresh_data_length);
|
refresh_data_length);
|
||||||
if (NULL == md)
|
if (NULL == md)
|
||||||
@ -1722,11 +1718,11 @@ handle_refresh_reveal_finished (void *cls,
|
|||||||
*/
|
*/
|
||||||
struct TALER_EXCHANGE_RefreshRevealHandle *
|
struct TALER_EXCHANGE_RefreshRevealHandle *
|
||||||
TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
||||||
size_t refresh_data_length,
|
size_t refresh_data_length,
|
||||||
const char *refresh_data,
|
const char *refresh_data,
|
||||||
uint16_t noreveal_index,
|
uint16_t noreveal_index,
|
||||||
TALER_EXCHANGE_RefreshRevealCallback reveal_cb,
|
TALER_EXCHANGE_RefreshRevealCallback reveal_cb,
|
||||||
void *reveal_cb_cls)
|
void *reveal_cb_cls)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGE_RefreshRevealHandle *rrh;
|
struct TALER_EXCHANGE_RefreshRevealHandle *rrh;
|
||||||
json_t *transfer_privs;
|
json_t *transfer_privs;
|
||||||
@ -1735,13 +1731,9 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
struct GNUNET_CURL_Context *ctx;
|
struct GNUNET_CURL_Context *ctx;
|
||||||
struct MeltData *md;
|
struct MeltData *md;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
if (GNUNET_YES !=
|
GNUNET_assert (GNUNET_YES ==
|
||||||
MAH_handle_is_ready (exchange))
|
MAH_handle_is_ready (exchange));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
md = deserialize_melt_data (refresh_data,
|
md = deserialize_melt_data (refresh_data,
|
||||||
refresh_data_length);
|
refresh_data_length);
|
||||||
if (NULL == md)
|
if (NULL == md)
|
||||||
|
@ -243,12 +243,8 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
json_t *refund_obj;
|
json_t *refund_obj;
|
||||||
CURL *eh;
|
CURL *eh;
|
||||||
|
|
||||||
if (GNUNET_YES !=
|
GNUNET_assert (GNUNET_YES ==
|
||||||
MAH_handle_is_ready (exchange))
|
MAH_handle_is_ready (exchange));
|
||||||
{
|
|
||||||
GNUNET_break (0);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
|
rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
|
||||||
rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
|
rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS));
|
||||||
rr.h_contract = *h_contract;
|
rr.h_contract = *h_contract;
|
||||||
|
@ -288,7 +288,7 @@ postgres_create_tables (void *cls)
|
|||||||
for a very long time (either by refunding the owner or by greedily
|
for a very long time (either by refunding the owner or by greedily
|
||||||
grabbing the money, depending on the Exchange's terms of service) */
|
grabbing the money, depending on the Exchange's terms of service) */
|
||||||
SQLEXEC ("CREATE TABLE IF NOT EXISTS reserves"
|
SQLEXEC ("CREATE TABLE IF NOT EXISTS reserves"
|
||||||
"(reserve_pub BYTEA PRIMARY KEY"
|
"(reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)"
|
||||||
",current_balance_val INT8 NOT NULL"
|
",current_balance_val INT8 NOT NULL"
|
||||||
",current_balance_frac INT4 NOT NULL"
|
",current_balance_frac INT4 NOT NULL"
|
||||||
",current_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
",current_balance_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
||||||
@ -343,7 +343,7 @@ postgres_create_tables (void *cls)
|
|||||||
/* Table with coins that have been (partially) spent, used to track
|
/* Table with coins that have been (partially) spent, used to track
|
||||||
coin information only once. */
|
coin information only once. */
|
||||||
SQLEXEC("CREATE TABLE IF NOT EXISTS known_coins "
|
SQLEXEC("CREATE TABLE IF NOT EXISTS known_coins "
|
||||||
"(coin_pub BYTEA NOT NULL PRIMARY KEY"
|
"(coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32)"
|
||||||
",denom_pub BYTEA NOT NULL REFERENCES denominations (pub)"
|
",denom_pub BYTEA NOT NULL REFERENCES denominations (pub)"
|
||||||
",denom_sig BYTEA NOT NULL"
|
",denom_sig BYTEA NOT NULL"
|
||||||
")");
|
")");
|
||||||
@ -405,7 +405,7 @@ postgres_create_tables (void *cls)
|
|||||||
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_commit_link "
|
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_commit_link "
|
||||||
"(session_hash BYTEA NOT NULL REFERENCES refresh_sessions (session_hash)"
|
"(session_hash BYTEA NOT NULL REFERENCES refresh_sessions (session_hash)"
|
||||||
",transfer_pub BYTEA NOT NULL CHECK(LENGTH(transfer_pub)=32)"
|
",transfer_pub BYTEA NOT NULL CHECK(LENGTH(transfer_pub)=32)"
|
||||||
",link_secret_enc BYTEA NOT NULL"
|
",link_secret_enc BYTEA NOT NULL CHECK(LENGTH(link_secret_enc)=64)"
|
||||||
",cnc_index INT2 NOT NULL"
|
",cnc_index INT2 NOT NULL"
|
||||||
")");
|
")");
|
||||||
/* Table with the commitments for the new coins that are to be created
|
/* Table with the commitments for the new coins that are to be created
|
||||||
@ -413,17 +413,12 @@ postgres_create_tables (void *cls)
|
|||||||
index and the index of the new coin, and the envelope of the new
|
index and the index of the new coin, and the envelope of the new
|
||||||
coin to be signed, as well as the encrypted information about the
|
coin to be signed, as well as the encrypted information about the
|
||||||
private key and the blinding factor for the coin (for verification
|
private key and the blinding factor for the coin (for verification
|
||||||
in case this cnc_index is chosen to be revealed)
|
in case this cnc_index is chosen to be revealed) */
|
||||||
|
|
||||||
NOTE: We might want to simplify this and not have the
|
|
||||||
newcoin_index and instead store all coin_evs and
|
|
||||||
link_vector_encs, one after the other, in two big BYTEAs.
|
|
||||||
(#3815) */
|
|
||||||
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_commit_coin "
|
SQLEXEC("CREATE TABLE IF NOT EXISTS refresh_commit_coin "
|
||||||
"(session_hash BYTEA NOT NULL REFERENCES refresh_sessions (session_hash) "
|
"(session_hash BYTEA NOT NULL REFERENCES refresh_sessions (session_hash) "
|
||||||
",cnc_index INT2 NOT NULL"
|
",cnc_index INT2 NOT NULL"
|
||||||
",newcoin_index INT2 NOT NULL"
|
",newcoin_index INT2 NOT NULL"
|
||||||
",link_vector_enc BYTEA NOT NULL"
|
",link_vector_enc BYTEA NOT NULL CHECK(LENGTH(link_vector_enc)=64)"
|
||||||
",coin_ev BYTEA NOT NULL"
|
",coin_ev BYTEA NOT NULL"
|
||||||
")");
|
")");
|
||||||
/* Table with the signatures over coins generated during a refresh
|
/* Table with the signatures over coins generated during a refresh
|
||||||
@ -3078,7 +3073,7 @@ postgres_insert_refresh_commit_coins (void *cls,
|
|||||||
GNUNET_PQ_query_param_uint16 (&coin_off),
|
GNUNET_PQ_query_param_uint16 (&coin_off),
|
||||||
GNUNET_PQ_query_param_auto_from_type (&commit_coins[i].refresh_link),
|
GNUNET_PQ_query_param_auto_from_type (&commit_coins[i].refresh_link),
|
||||||
GNUNET_PQ_query_param_fixed_size (commit_coins[i].coin_ev,
|
GNUNET_PQ_query_param_fixed_size (commit_coins[i].coin_ev,
|
||||||
commit_coins[i].coin_ev_size),
|
commit_coins[i].coin_ev_size),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
result = GNUNET_PQ_exec_prepared (session->conn,
|
result = GNUNET_PQ_exec_prepared (session->conn,
|
||||||
|
Loading…
Reference in New Issue
Block a user