-misc fixes

This commit is contained in:
Christian Grothoff 2021-11-06 19:57:34 +01:00
parent 59a017dbc7
commit 81f9b2c93e
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 25 additions and 2 deletions

View File

@ -249,6 +249,8 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("h_contract_terms", GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&dc.h_contract_terms), &dc.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("h_extensions",
&dc.h_extensions),
GNUNET_JSON_spec_fixed_auto ("h_wire", GNUNET_JSON_spec_fixed_auto ("h_wire",
&dc.h_wire), &dc.h_wire),
TALER_JSON_spec_absolute_time ("exchange_timestamp", TALER_JSON_spec_absolute_time ("exchange_timestamp",

View File

@ -228,6 +228,7 @@ CREATE TABLE IF NOT EXISTS deposit_confirmations
(master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE (master_pub BYTEA CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,serial_id BIGSERIAL UNIQUE ,serial_id BIGSERIAL UNIQUE
,h_contract_terms BYTEA CHECK (LENGTH(h_contract_terms)=64) ,h_contract_terms BYTEA CHECK (LENGTH(h_contract_terms)=64)
,h_extensions BYTEA CHECK (LENGTH(h_contract_terms)=64)
,h_wire BYTEA CHECK (LENGTH(h_wire)=64) ,h_wire BYTEA CHECK (LENGTH(h_wire)=64)
,exchange_timestamp INT8 NOT NULL ,exchange_timestamp INT8 NOT NULL
,refund_deadline INT8 NOT NULL ,refund_deadline INT8 NOT NULL

View File

@ -1030,10 +1030,11 @@ postgres_insert_deposit_confirmation (
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&dc->master_public_key), GNUNET_PQ_query_param_auto_from_type (&dc->master_public_key),
GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms), GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (&dc->h_extensions),
GNUNET_PQ_query_param_auto_from_type (&dc->h_wire), GNUNET_PQ_query_param_auto_from_type (&dc->h_wire),
TALER_PQ_query_param_absolute_time (&dc->exchange_timestamp), TALER_PQ_query_param_absolute_time (&dc->exchange_timestamp),
TALER_PQ_query_param_absolute_time (&dc->refund_deadline),
TALER_PQ_query_param_absolute_time (&dc->wire_deadline), TALER_PQ_query_param_absolute_time (&dc->wire_deadline),
TALER_PQ_query_param_absolute_time (&dc->refund_deadline),
TALER_PQ_query_param_amount (&dc->amount_without_fee), TALER_PQ_query_param_amount (&dc->amount_without_fee),
GNUNET_PQ_query_param_auto_from_type (&dc->coin_pub), GNUNET_PQ_query_param_auto_from_type (&dc->coin_pub),
GNUNET_PQ_query_param_auto_from_type (&dc->merchant), GNUNET_PQ_query_param_auto_from_type (&dc->merchant),
@ -1110,6 +1111,8 @@ deposit_confirmation_cb (void *cls,
&serial_id), &serial_id),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
&dc.h_contract_terms), &dc.h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("h_extensions",
&dc.h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("h_wire", GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&dc.h_wire), &dc.h_wire),
GNUNET_PQ_result_spec_absolute_time ("exchange_timestamp", GNUNET_PQ_result_spec_absolute_time ("exchange_timestamp",

View File

@ -41,6 +41,7 @@ DROP TABLE IF EXISTS wire_out CASCADE;
DROP TABLE IF EXISTS wire_targets CASCADE; DROP TABLE IF EXISTS wire_targets CASCADE;
DROP TABLE IF EXISTS wire_fee CASCADE; DROP TABLE IF EXISTS wire_fee CASCADE;
DROP TABLE IF EXISTS deposits CASCADE; DROP TABLE IF EXISTS deposits CASCADE;
DROP TABLE IF EXISTS extension_details CASCADE;
DROP TABLE IF EXISTS refunds CASCADE; DROP TABLE IF EXISTS refunds CASCADE;
DROP TABLE IF EXISTS refresh_commitments CASCADE; DROP TABLE IF EXISTS refresh_commitments CASCADE;
DROP TABLE IF EXISTS refresh_revealed_coins CASCADE; DROP TABLE IF EXISTS refresh_revealed_coins CASCADE;

View File

@ -233,6 +233,7 @@ typedef void
* *
* @param auditor the auditor handle; the auditor must be ready to operate * @param auditor the auditor handle; the auditor must be ready to operate
* @param h_wire hash of merchant wire details * @param h_wire hash of merchant wire details
* @param h_extensions hash over the extensions, if any
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor) * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor)
* @param exchange_timestamp timestamp when the contract was finalized, must not be too far in the future * @param exchange_timestamp timestamp when the contract was finalized, must not be too far in the future
* @param wire_deadline date until which the exchange should wire the funds * @param wire_deadline date until which the exchange should wire the funds
@ -256,6 +257,7 @@ struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation ( TALER_AUDITOR_deposit_confirmation (
struct TALER_AUDITOR_Handle *auditor, struct TALER_AUDITOR_Handle *auditor,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHash *h_contract_terms,
struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Absolute wire_deadline, struct GNUNET_TIME_Absolute wire_deadline,

View File

@ -276,6 +276,11 @@ struct TALER_AUDITORDB_DepositConfirmation
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHash h_contract_terms;
/**
* Hash over the extensions for the deposit.
*/
struct TALER_ExtensionContractHash h_extensions;
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */

View File

@ -153,6 +153,7 @@ handle_deposit_confirmation_finished (void *cls,
* Verify signature information about the deposit-confirmation. * Verify signature information about the deposit-confirmation.
* *
* @param h_wire hash of merchant wire details * @param h_wire hash of merchant wire details
* @param h_extensions hash over the extensions, if any
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor) * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor)
* @param exchange_timestamp timestamp when the deposit was received by the wallet * @param exchange_timestamp timestamp when the deposit was received by the wallet
* @param refund_deadline date until which the merchant can issue a refund to the customer via the auditor (can be zero if refunds are not allowed); must not be after the @a wire_deadline * @param refund_deadline date until which the merchant can issue a refund to the customer via the auditor (can be zero if refunds are not allowed); must not be after the @a wire_deadline
@ -170,6 +171,7 @@ handle_deposit_confirmation_finished (void *cls,
*/ */
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
verify_signatures (const struct TALER_MerchantWireHash *h_wire, verify_signatures (const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHash *h_contract_terms,
struct GNUNET_TIME_Absolute exchange_timestamp, struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Absolute wire_deadline, struct GNUNET_TIME_Absolute wire_deadline,
@ -188,7 +190,7 @@ verify_signatures (const struct TALER_MerchantWireHash *h_wire,
if (GNUNET_OK != if (GNUNET_OK !=
TALER_exchange_deposit_confirm_verify (h_contract_terms, TALER_exchange_deposit_confirm_verify (h_contract_terms,
h_wire, h_wire,
NULL /* h_extensions! */, h_extensions,
exchange_timestamp, exchange_timestamp,
wire_deadline, wire_deadline,
refund_deadline, refund_deadline,
@ -235,6 +237,7 @@ struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation ( TALER_AUDITOR_deposit_confirmation (
struct TALER_AUDITOR_Handle *auditor, struct TALER_AUDITOR_Handle *auditor,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHash *h_wire,
const struct TALER_ExtensionContractHash *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHash *h_contract_terms,
struct GNUNET_TIME_Absolute exchange_timestamp, struct GNUNET_TIME_Absolute exchange_timestamp,
struct GNUNET_TIME_Absolute wire_deadline, struct GNUNET_TIME_Absolute wire_deadline,
@ -266,6 +269,7 @@ TALER_AUDITOR_deposit_confirmation (
TALER_AUDITOR_handle_is_ready_ (auditor)); TALER_AUDITOR_handle_is_ready_ (auditor));
if (GNUNET_OK != if (GNUNET_OK !=
verify_signatures (h_wire, verify_signatures (h_wire,
h_extensions,
h_contract_terms, h_contract_terms,
exchange_timestamp, exchange_timestamp,
wire_deadline, wire_deadline,
@ -289,6 +293,8 @@ TALER_AUDITOR_deposit_confirmation (
= GNUNET_JSON_PACK ( = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("h_wire", GNUNET_JSON_pack_data_auto ("h_wire",
h_wire), h_wire),
GNUNET_JSON_pack_data_auto ("h_extensions",
h_extensions),
GNUNET_JSON_pack_data_auto ("h_contract_terms", GNUNET_JSON_pack_data_auto ("h_contract_terms",
h_contract_terms), h_contract_terms),
GNUNET_JSON_pack_time_abs ("exchange_timestamp", GNUNET_JSON_pack_time_abs ("exchange_timestamp",

View File

@ -205,6 +205,7 @@ auditor_cb (void *cls,
aie->dch = TALER_AUDITOR_deposit_confirmation ( aie->dch = TALER_AUDITOR_deposit_confirmation (
ah, ah,
&dh->h_wire, &dh->h_wire,
&dh->h_extensions,
&dh->h_contract_terms, &dh->h_contract_terms,
dh->exchange_timestamp, dh->exchange_timestamp,
dh->wire_deadline, dh->wire_deadline,

View File

@ -199,6 +199,7 @@ deposit_confirmation_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)
{ {
static struct TALER_ExtensionContractHash no_h_extensions;
struct DepositConfirmationState *dcs = cls; struct DepositConfirmationState *dcs = cls;
const struct TALER_TESTING_Command *deposit_cmd; const struct TALER_TESTING_Command *deposit_cmd;
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHash h_wire;
@ -317,6 +318,7 @@ deposit_confirmation_run (void *cls,
} }
dcs->dc = TALER_AUDITOR_deposit_confirmation (dcs->auditor, dcs->dc = TALER_AUDITOR_deposit_confirmation (dcs->auditor,
&h_wire, &h_wire,
&no_h_extensions,
&h_contract_terms, &h_contract_terms,
*exchange_timestamp, *exchange_timestamp,
*wire_deadline, *wire_deadline,