@@ -457,7 +457,12 @@ where
457457 if diff > ten_minutes {
458458 return Err ( LSPS5ClientError :: InvalidTimestamp ( signature_timestamp. to_rfc3339 ( ) ) ) ;
459459 }
460-
460+ println ! (
461+ "LSPS5: Received notification from {} at {}" ,
462+ counterparty_node_id,
463+ signature_timestamp. to_rfc3339( )
464+ ) ;
465+ println ! ( "LSPS5: Notification: {:?}" , notification) ;
461466 let message = format ! (
462467 "LSPS5: DO NOT SIGN THIS MESSAGE MANUALLY: LSP: At {} I notify {:?}" ,
463468 signature_timestamp. to_rfc3339( ) ,
@@ -519,16 +524,14 @@ where
519524 /// - `counterparty_node_id`: the LSP’s public key, used to verify the signature.
520525 /// - `timestamp`: ISO8601 time when the LSP created the notification.
521526 /// - `signature`: the zbase32-encoded LN signature over timestamp+body.
522- /// - `notification_json `: the JSON string of the JSON-RPC notification object .
527+ /// - `notification `: the [`WebhookNotification`] received from the LSP .
523528 ///
524- /// On success, emits [`LSPS5ClientEvent::WebhookNotificationReceived`]
525- /// and returns the parsed [`WebhookNotification`].
529+ /// On success, emits [`LSPS5ClientEvent::WebhookNotificationReceived`].
526530 ///
527531 /// Failure reasons include:
528532 /// - Timestamp too old (drift > 10 minutes)
529533 /// - Replay attack detected (signature reused)
530534 /// - Invalid signature (crypto check fails)
531- /// - JSON parse errors for malformed `notification_json`
532535 ///
533536 /// Clients should call this method upon receiving a [`LSPS5ServiceEvent::SendWebhookNotification`]
534537 /// event, before taking action on the notification. This guarantees that only authentic,
@@ -539,30 +542,28 @@ where
539542 /// [`WebhookNotification`]: super::msgs::WebhookNotification
540543 pub fn parse_webhook_notification (
541544 & self , counterparty_node_id : PublicKey , timestamp : & LSPSDateTime , signature : & str ,
542- notification_json : & str ,
543- ) -> Result < WebhookNotification , LSPS5ClientError > {
544- let event_queue_notifier = self . pending_events . notifier ( ) ;
545- let notification: WebhookNotification = serde_json:: from_str ( notification_json)
546- . map_err ( |e| LSPS5ClientError :: DeserializeError ( e. to_string ( ) ) ) ?;
547-
548- self . check_signature_exists ( signature) ?;
549-
550- self . store_signature ( signature. to_string ( ) ) ;
551-
545+ notification : & WebhookNotification ,
546+ ) -> Result < ( ) , LSPS5ClientError > {
552547 match self . verify_notification_signature (
553548 counterparty_node_id,
554549 timestamp,
555550 signature,
556551 & notification,
557552 ) {
558553 Ok ( signature_valid) => {
554+ let event_queue_notifier = self . pending_events . notifier ( ) ;
555+
556+ self . check_signature_exists ( signature) ?;
557+
558+ self . store_signature ( signature. to_string ( ) ) ;
559+
559560 event_queue_notifier. enqueue ( LSPS5ClientEvent :: WebhookNotificationReceived {
560561 counterparty_node_id,
561562 notification : notification. clone ( ) ,
562563 timestamp : timestamp. clone ( ) ,
563564 signature_valid,
564565 } ) ;
565- Ok ( notification )
566+ Ok ( ( ) )
566567 } ,
567568 Err ( e) => Err ( e) ,
568569 }
0 commit comments