diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-12-05 17:16:00 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-12-05 17:16:00 +0100 |
commit | 67de20d26e7eed951528db6aaedaf163108f49a5 (patch) | |
tree | 900f533ef8cd5ce0217fab1ff20b61d228ae753b /src/include/taler_exchangedb_plugin.h | |
parent | c0d2af8a49a35e4face7e758aad670de94682633 (diff) |
major rework of withdraw transaction to use stored procedure and (presumably) reduce serialization failures by avoiding SELECT before INSERT
Diffstat (limited to 'src/include/taler_exchangedb_plugin.h')
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 9a1dc78b6..fd2f3dc42 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -496,7 +496,7 @@ struct TALER_EXCHANGEDB_ClosingTransfer struct TALER_ReservePublicKeyP reserve_pub; /** - * Amount that was transferred to the exchange. + * Amount that was transferred from the exchange. */ struct TALER_Amount amount; @@ -2512,23 +2512,70 @@ struct TALER_EXCHANGEDB_Plugin * @return statement execution status */ enum GNUNET_DB_QueryStatus - (*insert_withdraw_info)( + (*insert_withdraw_infoXX)( void *cls, const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable); /** + * Perform withdraw operation, checking for sufficient balance + * and possibly persisting the withdrawal details. + * + * @param cls the `struct PostgresClosure` with the plugin-specific state + * @param collectable corresponding collectable coin (blind signature) + * if a coin is found + * @param now current time (rounded) + * @param[out] found set to true if the reserve was found + * @param[out] balance_ok set to true if the balance was sufficient + * @param[out] kyc set to the KYC status of the reserve + * @param[out] reserve_uuid set to the UUID of the reserve + * @return query execution status + */ + enum GNUNET_DB_QueryStatus + (*do_withdraw)( + void *cls, + const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable, + struct GNUNET_TIME_Absolute now, + bool *found, + bool *balance_ok, + struct TALER_EXCHANGEDB_KycStatus *kyc_ok, + uint64_t *reserve_uuid); + + + /** + * Check that reserve remains below threshold for KYC + * checks after withdraw operation. + * + * @param cls the `struct PostgresClosure` with the plugin-specific state + * @param reserve_uuid reserve to check + * @param withdraw_start starting point to accumulate from + * @param upper_limit maximum amount allowed + * @param[out] below_limit set to true if the limit was not exceeded + * @return query execution status + */ + enum GNUNET_DB_QueryStatus + (*do_withdraw_limit_check)( + void *cls, + uint64_t reserve_uuid, + struct GNUNET_TIME_Absolute withdraw_start, + const struct TALER_Amount *upper_limit, + bool *below_limit); + + + /** * Get all of the transaction history associated with the specified * reserve. * * @param cls the @e cls of this struct with the plugin-specific state * @param reserve_pub public key of the reserve + * @param[out] balance set to the reserve balance * @param[out] rhp set to known transaction history (NULL if reserve is unknown) * @return transaction status */ enum GNUNET_DB_QueryStatus (*get_reserve_history)(void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, + struct TALER_Amount *balance, struct TALER_EXCHANGEDB_ReserveHistory **rhp); |