Skip to content

Commit b0a5e5a

Browse files
committed
f: Remove duplicate functions from DefaultMessageRouter
Removed repeated function definitions to keep the codebase clean and reduce redundancy.
1 parent d689961 commit b0a5e5a

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ where
545545
Self { network_graph, entropy_source }
546546
}
547547

548-
fn create_blinded_paths_from_iter<
548+
pub(crate) fn create_blinded_paths_from_iter<
549549
I: ExactSizeIterator<Item = MessageForwardNode>,
550550
T: secp256k1::Signing + secp256k1::Verification,
551551
>(
@@ -659,36 +659,6 @@ where
659659
}
660660
}
661661
}
662-
663-
pub(crate) fn create_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
664-
network_graph: &G, recipient: PublicKey, context: MessageContext,
665-
peers: Vec<MessageForwardNode>, entropy_source: &ES, secp_ctx: &Secp256k1<T>,
666-
) -> Result<Vec<BlindedMessagePath>, ()> {
667-
Self::create_blinded_paths_from_iter(
668-
network_graph,
669-
recipient,
670-
context,
671-
peers.into_iter(),
672-
entropy_source,
673-
secp_ctx,
674-
false,
675-
)
676-
}
677-
678-
pub(crate) fn create_compact_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
679-
network_graph: &G, recipient: PublicKey, context: MessageContext,
680-
peers: Vec<MessageForwardNode>, entropy_source: &ES, secp_ctx: &Secp256k1<T>,
681-
) -> Result<Vec<BlindedMessagePath>, ()> {
682-
Self::create_blinded_paths_from_iter(
683-
network_graph,
684-
recipient,
685-
context,
686-
peers.into_iter(),
687-
entropy_source,
688-
secp_ctx,
689-
true,
690-
)
691-
}
692662
}
693663

694664
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref> MessageRouter
@@ -707,27 +677,29 @@ where
707677
&self, recipient: PublicKey, context: MessageContext, peers: Vec<MessageForwardNode>,
708678
secp_ctx: &Secp256k1<T>,
709679
) -> Result<Vec<BlindedMessagePath>, ()> {
710-
Self::create_blinded_paths(
680+
Self::create_blinded_paths_from_iter(
711681
&self.network_graph,
712682
recipient,
713683
context,
714-
peers,
684+
peers.into_iter(),
715685
&self.entropy_source,
716686
secp_ctx,
687+
false,
717688
)
718689
}
719690

720691
fn create_compact_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
721692
&self, recipient: PublicKey, context: MessageContext, peers: Vec<MessageForwardNode>,
722693
secp_ctx: &Secp256k1<T>,
723694
) -> Result<Vec<BlindedMessagePath>, ()> {
724-
Self::create_compact_blinded_paths(
695+
Self::create_blinded_paths_from_iter(
725696
&self.network_graph,
726697
recipient,
727698
context,
728-
peers,
699+
peers.into_iter(),
729700
&self.entropy_source,
730701
secp_ctx,
702+
true,
731703
)
732704
}
733705
}

0 commit comments

Comments
 (0)