@@ -68,8 +68,8 @@ pub struct LSPS5ServiceConfig {
68
68
69
69
/// Default maximum number of webhooks allowed per client.
70
70
pub const DEFAULT_MAX_WEBHOOKS_PER_CLIENT : u32 = 10 ;
71
- /// Default notification cooldown time in hours .
72
- pub const DEFAULT_NOTIFICATION_COOLDOWN_HOURS : Duration = Duration :: from_secs ( 60 * 60 ) ; // 1 hour
71
+ /// Default notification cooldown time in minutes .
72
+ pub const NOTIFICATION_COOLDOWN_TIME : Duration = Duration :: from_secs ( 60 ) ; // 1 minute
73
73
74
74
// Default configuration for LSPS5 service.
75
75
impl Default for LSPS5ServiceConfig {
@@ -330,13 +330,13 @@ where
330
330
/// node key, and enqueues HTTP POSTs to all registered webhook URLs for that client.
331
331
///
332
332
/// This may fail if a similar notification was sent too recently,
333
- /// violating the notification cooldown period defined in [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `].
333
+ /// violating the notification cooldown period defined in [`NOTIFICATION_COOLDOWN_TIME `].
334
334
///
335
335
/// # Parameters
336
336
/// - `client_id`: the client's node-ID whose webhooks should be invoked.
337
337
///
338
338
/// [`WebhookNotificationMethod::LSPS5PaymentIncoming`]: super::msgs::WebhookNotificationMethod::LSPS5PaymentIncoming
339
- /// [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `]: super::service::DEFAULT_NOTIFICATION_COOLDOWN_HOURS
339
+ /// [`NOTIFICATION_COOLDOWN_TIME `]: super::service::NOTIFICATION_COOLDOWN_TIME
340
340
pub fn notify_payment_incoming ( & self , client_id : PublicKey ) -> Result < ( ) , LSPS5ProtocolError > {
341
341
let notification = WebhookNotification :: payment_incoming ( ) ;
342
342
self . send_notifications_to_client_webhooks ( client_id, notification)
@@ -351,14 +351,14 @@ where
351
351
/// registered webhooks.
352
352
///
353
353
/// This may fail if a similar notification was sent too recently,
354
- /// violating the notification cooldown period defined in [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `].
354
+ /// violating the notification cooldown period defined in [`NOTIFICATION_COOLDOWN_TIME `].
355
355
///
356
356
/// # Parameters
357
357
/// - `client_id`: the client's node-ID whose webhooks should be invoked.
358
358
/// - `timeout`: the block height at which the channel contract will expire.
359
359
///
360
360
/// [`WebhookNotificationMethod::LSPS5ExpirySoon`]: super::msgs::WebhookNotificationMethod::LSPS5ExpirySoon
361
- /// [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `]: super::service::DEFAULT_NOTIFICATION_COOLDOWN_HOURS
361
+ /// [`NOTIFICATION_COOLDOWN_TIME `]: super::service::NOTIFICATION_COOLDOWN_TIME
362
362
pub fn notify_expiry_soon (
363
363
& self , client_id : PublicKey , timeout : u32 ,
364
364
) -> Result < ( ) , LSPS5ProtocolError > {
@@ -373,13 +373,13 @@ where
373
373
/// signs it, and sends it to all of the client's registered webhook URLs.
374
374
///
375
375
/// This may fail if a similar notification was sent too recently,
376
- /// violating the notification cooldown period defined in [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `].
376
+ /// violating the notification cooldown period defined in [`NOTIFICATION_COOLDOWN_TIME `].
377
377
///
378
378
/// # Parameters
379
379
/// - `client_id`: the client's node-ID whose webhooks should be invoked.
380
380
///
381
381
/// [`WebhookNotificationMethod::LSPS5LiquidityManagementRequest`]: super::msgs::WebhookNotificationMethod::LSPS5LiquidityManagementRequest
382
- /// [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `]: super::service::DEFAULT_NOTIFICATION_COOLDOWN_HOURS
382
+ /// [`NOTIFICATION_COOLDOWN_TIME `]: super::service::NOTIFICATION_COOLDOWN_TIME
383
383
pub fn notify_liquidity_management_request (
384
384
& self , client_id : PublicKey ,
385
385
) -> Result < ( ) , LSPS5ProtocolError > {
@@ -394,13 +394,13 @@ where
394
394
/// notification, signs it, and enqueues HTTP POSTs to each registered webhook.
395
395
///
396
396
/// This may fail if a similar notification was sent too recently,
397
- /// violating the notification cooldown period defined in [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `].
397
+ /// violating the notification cooldown period defined in [`NOTIFICATION_COOLDOWN_TIME `].
398
398
///
399
399
/// # Parameters
400
400
/// - `client_id`: the client's node-ID whose webhooks should be invoked.
401
401
///
402
402
/// [`WebhookNotificationMethod::LSPS5OnionMessageIncoming`]: super::msgs::WebhookNotificationMethod::LSPS5OnionMessageIncoming
403
- /// [`DEFAULT_NOTIFICATION_COOLDOWN_HOURS `]: super::service::DEFAULT_NOTIFICATION_COOLDOWN_HOURS
403
+ /// [`NOTIFICATION_COOLDOWN_TIME `]: super::service::NOTIFICATION_COOLDOWN_TIME
404
404
pub fn notify_onion_message_incoming (
405
405
& self , client_id : PublicKey ,
406
406
) -> Result < ( ) , LSPS5ProtocolError > {
@@ -429,7 +429,7 @@ where
429
429
. last_notification_sent
430
430
. get ( & notification. method )
431
431
. map ( |last_sent| now. duration_since ( & last_sent) )
432
- . map_or ( false , |duration| duration < DEFAULT_NOTIFICATION_COOLDOWN_HOURS )
432
+ . map_or ( false , |duration : Duration | duration < NOTIFICATION_COOLDOWN_TIME )
433
433
} ) ;
434
434
435
435
if rate_limit_applies {
0 commit comments