exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 3df3d5455ddde27a0a1c0095c580e0b6d15c2565
parent 7b97e837c0e73aabb4f1691d1414f43eecf4562f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 27 Apr 2026 19:53:54 +0200

implement v35: add default_p2p_push_expiration to /keys

Diffstat:
Msrc/exchange/taler-exchange-httpd.c | 16++++++++++++++++
Msrc/exchange/taler-exchange-httpd.h | 5+++++
Msrc/exchange/taler-exchange-httpd_get-config.h | 2+-
Msrc/exchange/taler-exchange-httpd_get-keys.c | 2++
Msrc/include/taler/exchange/get-keys.h | 7+++++++
Msrc/lib/exchange_api_handle.c | 15+++++++++++++--
6 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c @@ -127,6 +127,8 @@ struct GNUNET_TIME_Relative TEH_max_keys_caching; struct GNUNET_TIME_Relative TEH_reserve_closing_delay; +struct GNUNET_TIME_Relative TEH_default_p2p_expiration; + struct GNUNET_TIME_Relative TEH_aml_program_timeout; struct TALER_MasterPublicKeyP TEH_master_public_key; @@ -2184,6 +2186,20 @@ exchange_serve_process_config (const char *cfg_fn) } if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (TEH_cfg, + "exchange", + "DEFAULT_P2P_EXPIRATION", + &TEH_default_p2p_expiration)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, + "exchange", + "DEFAULT_P2P_EXPIRATION"); + /* use default */ + TEH_default_p2p_expiration + = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_WEEKS, + 4); + } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (TEH_cfg, "exchangedb", "MAX_AML_PROGRAM_RUNTIME", &TEH_aml_program_timeout)) diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h @@ -43,6 +43,11 @@ extern struct GNUNET_TIME_Relative TEH_max_keys_caching; extern struct GNUNET_TIME_Relative TEH_reserve_closing_delay; /** + * How long should P2P push payments be valid for by default. + */ +extern struct GNUNET_TIME_Relative TEH_default_p2p_expiration; + +/** * How long do we allow AML programs to run? */ extern struct GNUNET_TIME_Relative TEH_aml_program_timeout; diff --git a/src/exchange/taler-exchange-httpd_get-config.h b/src/exchange/taler-exchange-httpd_get-config.h @@ -41,7 +41,7 @@ * * Returned via both /config and /keys endpoints. */ -#define EXCHANGE_PROTOCOL_VERSION "34:0:0" +#define EXCHANGE_PROTOCOL_VERSION "35:0:1" /** diff --git a/src/exchange/taler-exchange-httpd_get-keys.c b/src/exchange/taler-exchange-httpd_get-keys.c @@ -2475,6 +2475,8 @@ create_krd (struct TEH_KeyStateHandle *ksh, &TEH_master_public_key), GNUNET_JSON_pack_time_rel ("reserve_closing_delay", TEH_reserve_closing_delay), + GNUNET_JSON_pack_time_rel ("default_p2p_push_expiration", + TEH_default_p2p_expiration), GNUNET_JSON_pack_array_incref ("signkeys", signkeys), GNUNET_JSON_pack_array_incref ("recoup", diff --git a/src/include/taler/exchange/get-keys.h b/src/include/taler/exchange/get-keys.h @@ -778,6 +778,13 @@ struct TALER_EXCHANGE_Keys * @since protocol v30. */ bool disable_direct_deposit; + + /** + * How long should a P2P push payment be valid by default. + */ + struct GNUNET_TIME_Relative default_p2p_push_expiration; + + }; diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c @@ -36,12 +36,12 @@ * Which version of the Taler protocol is implemented * by this library? Used to determine compatibility. */ -#define EXCHANGE_PROTOCOL_CURRENT 33 +#define EXCHANGE_PROTOCOL_CURRENT 35 /** * How many versions are we backwards compatible with? */ -#define EXCHANGE_PROTOCOL_AGE 0 +#define EXCHANGE_PROTOCOL_AGE 1 /** * Set to 1 for extra debug logging. @@ -996,6 +996,11 @@ TALER_EXCHANGE_decode_keys_json_ ( GNUNET_JSON_spec_relative_time ( "reserve_closing_delay", &key_data->reserve_closing_delay), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_relative_time ( + "default_p2p_push_expiration", + &key_data->default_p2p_push_expiration), + NULL), GNUNET_JSON_spec_string ( "currency", &currency), @@ -2318,6 +2323,12 @@ TALER_EXCHANGE_keys_to_json (const struct TALER_EXCHANGE_Keys *kd) &kd->master_pub), GNUNET_JSON_pack_time_rel ("reserve_closing_delay", kd->reserve_closing_delay), + GNUNET_JSON_pack_allow_null ( + GNUNET_TIME_relative_is_zero (kd->default_p2p_push_expiration) + ? GNUNET_JSON_pack_string ("dummy", + NULL) + : GNUNET_JSON_pack_time_rel ("default_p2p_push_expiration", + kd->default_p2p_push_expiration)), GNUNET_JSON_pack_timestamp ("list_issue_date", kd->list_issue_date), GNUNET_JSON_pack_array_steal ("global_fees",