From: Jeffrey Czyz Date: Wed, 18 Oct 2023 23:24:07 +0000 (-0500) Subject: Clean up peel_onion name, parameters, and docs X-Git-Tag: v0.0.118~11^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=905028b61581f1d78225de9e518297f53159a5f4;p=rust-lightning Clean up peel_onion name, parameters, and docs For consistency with other functions and doc cleanliness. --- diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index 79bd57243..8960058fa 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -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( - node_signer: NS, secp_ctx: &Secp256k1, 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( + msg: &OnionMessage, secp_ctx: &Secp256k1, node_signer: NS, logger: L, + custom_handler: CMH, ) -> Result::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,