]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Clean up peel_onion name, parameters, and docs
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 18 Oct 2023 23:24:07 +0000 (18:24 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 18 Oct 2023 23:33:14 +0000 (18:33 -0500)
For consistency with other functions and doc cleanliness.

lightning/src/onion_message/messenger.rs

index 79bd5724364c1701e4393b2d70ae288b3270f5af..8960058fa9f83803f9ec74d220347bfd9193aefc 100644 (file)
@@ -344,11 +344,13 @@ where
        }))
 }
 
-/// Decode one layer of an incoming onion message
-/// Returns either a Forward (another onion message), or Receive (decrypted content)
-pub fn peel_onion<NS: Deref, L: Deref, CMH: Deref>(
-       node_signer: NS, secp_ctx: &Secp256k1<secp256k1::All>, logger: L, custom_handler: CMH,
-       msg: &OnionMessage,
+/// Decode one layer of an incoming [`OnionMessage`].
+///
+/// Returns either the next layer of the onion for forwarding or the decrypted content for the
+/// receiver.
+pub fn peel_onion_message<NS: Deref, L: Deref, CMH: Deref>(
+       msg: &OnionMessage, secp_ctx: &Secp256k1<secp256k1::All>, node_signer: NS, logger: L,
+       custom_handler: CMH,
 ) -> Result<PeeledOnion<<<CMH>::Target as CustomOnionMessageHandler>::CustomMessage>, ()>
 where
        NS::Target: NodeSigner,
@@ -584,8 +586,8 @@ where
        CMH::Target: CustomOnionMessageHandler,
 {
        fn handle_onion_message(&self, _peer_node_id: &PublicKey, msg: &OnionMessage) {
-               match peel_onion(
-                       &*self.node_signer, &self.secp_ctx, &*self.logger, &*self.custom_handler, msg
+               match peel_onion_message(
+                       msg, &self.secp_ctx, &*self.node_signer, &*self.logger, &*self.custom_handler
                ) {
                        Ok(PeeledOnion::Receive(message, path_id, reply_path)) => {
                                log_trace!(self.logger,