Skip to content

Commit

Permalink
Clean up peel_onion name, parameters, and docs
Browse files Browse the repository at this point in the history
For consistency with other functions and doc cleanliness.
  • Loading branch information
jkczyz committed Oct 18, 2023
1 parent 80ae66a commit 905028b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lightning/src/onion_message/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 905028b

Please sign in to comment.