aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-23 19:01:28 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-23 19:01:28 +0200
commitb054c969cbd84f7ed0f61da3db6a8168b944318f (patch)
treec0ffbd484e5edfa11382fbdc2a50f225371509dc
parentcf358f9546c89d9a52c444d18def703547a9d223 (diff)
downloadexchange-b054c969cbd84f7ed0f61da3db6a8168b944318f.tar.gz
exchange-b054c969cbd84f7ed0f61da3db6a8168b944318f.tar.bz2
exchange-b054c969cbd84f7ed0f61da3db6a8168b944318f.zip
-add more accounting fields to reserve table
-rw-r--r--src/exchangedb/common-0001.sql6
-rw-r--r--src/exchangedb/exchange-0001-part.sql10
-rw-r--r--src/lib/exchange_api_purse_create_with_merge.c6
3 files changed, 17 insertions, 5 deletions
diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql
index 1bf3e6308..a96b91fa1 100644
--- a/src/exchangedb/common-0001.sql
+++ b/src/exchangedb/common-0001.sql
@@ -106,6 +106,10 @@ BEGIN
',reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)'
',current_balance_val INT8 NOT NULL'
',current_balance_frac INT4 NOT NULL'
+ ',purses_active INT8 NOT NULL DEFAULT(0)'
+ ',purses_allowed INT8 NOT NULL DEFAULT(0)'
+ ',kyc_required BOOLEAN NOT NULL DEFAULT(FALSE)'
+ ',kyc_passed BOOLEAN NOT NULL DEFAULT(FALSE)'
',expiration_date INT8 NOT NULL'
',gc_date INT8 NOT NULL'
') %s ;'
@@ -2331,7 +2335,7 @@ BEGIN
DROP CONSTRAINT IF EXISTS wads_in_pkey CASCADE
,DROP CONSTRAINT IF EXISTS wads_in_wad_id_origin_exchange_url_key
;
-
+
ALTER TABLE IF EXISTS wad_in_entries
DROP CONSTRAINT IF EXISTS wad_in_entries_pkey CASCADE
;
diff --git a/src/exchangedb/exchange-0001-part.sql b/src/exchangedb/exchange-0001-part.sql
index b3e62a1e6..0a333880b 100644
--- a/src/exchangedb/exchange-0001-part.sql
+++ b/src/exchangedb/exchange-0001-part.sql
@@ -99,7 +99,15 @@ COMMENT ON TABLE reserves
COMMENT ON COLUMN reserves.reserve_pub
IS 'EdDSA public key of the reserve. Knowledge of the private key implies ownership over the balance.';
COMMENT ON COLUMN reserves.current_balance_val
- IS 'Current balance remaining with the reserve';
+ IS 'Current balance remaining with the reserve.';
+COMMENT ON COLUMN reserves.purses_active
+ IS 'Number of purses that were created by this reserve that are not expired and not fully paid.';
+COMMENT ON COLUMN reserves.purses_allowed
+ IS 'Number of purses that this reserve is allowed to have active at most.';
+COMMENT ON COLUMN reserves.kyc_required
+ IS 'True if a KYC check must have been passed before withdrawing from this reserve. Set to true once a reserve received a P2P payment.';
+COMMENT ON COLUMN reserves.kyc_passed
+ IS 'True once KYC was passed for this reserve. The KYC details are then available via the wire_targets table under the key of wire_target_h_payto which is to be derived from the reserve_pub and the base URL of this exchange.';
COMMENT ON COLUMN reserves.expiration_date
IS 'Used to trigger closing of reserves that have not been drained after some time';
COMMENT ON COLUMN reserves.gc_date
diff --git a/src/lib/exchange_api_purse_create_with_merge.c b/src/lib/exchange_api_purse_create_with_merge.c
index 61d4e545d..acf60ceee 100644
--- a/src/lib/exchange_api_purse_create_with_merge.c
+++ b/src/lib/exchange_api_purse_create_with_merge.c
@@ -345,7 +345,7 @@ TALER_EXCHANGE_purse_create_with_merge (
GNUNET_free (pcm);
return NULL;
}
- TALER_wallet_purse_create_sign (purse_expiration,
+ TALER_wallet_purse_create_sign (pcm->purse_expiration,
&pcm->h_contract_terms,
&merge_pub,
min_age,
@@ -359,7 +359,7 @@ TALER_EXCHANGE_purse_create_with_merge (
&merge_sig);
TALER_wallet_account_merge_sign (merge_timestamp,
&pcm->purse_pub,
- purse_expiration,
+ pcm->purse_expiration,
&pcm->h_contract_terms,
&pcm->purse_value_after_fees,
min_age,
@@ -416,7 +416,7 @@ TALER_EXCHANGE_purse_create_with_merge (
GNUNET_JSON_pack_timestamp ("merge_timestamp",
merge_timestamp),
GNUNET_JSON_pack_timestamp ("purse_expiration",
- purse_expiration));
+ pcm->purse_expiration));
GNUNET_assert (NULL != create_with_merge_obj);
GNUNET_free (econtract);
eh = TALER_EXCHANGE_curl_easy_get_ (pcm->url);