Skip to content

Commit cadad5d

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

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
>(
@@ -655,36 +655,6 @@ where
655655
}
656656
}
657657
}
658-
659-
pub(crate) fn create_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
660-
network_graph: &G, recipient: PublicKey, context: MessageContext,
661-
peers: Vec<MessageForwardNode>, entropy_source: &ES, secp_ctx: &Secp256k1<T>,
662-
) -> Result<Vec<BlindedMessagePath>, ()> {
663-
Self::create_blinded_paths_from_iter(
664-
network_graph,
665-
recipient,
666-
context,
667-
peers.into_iter(),
668-
entropy_source,
669-
secp_ctx,
670-
false,
671-
)
672-
}
673-
674-
pub(crate) fn create_compact_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
675-
network_graph: &G, recipient: PublicKey, context: MessageContext,
676-
peers: Vec<MessageForwardNode>, entropy_source: &ES, secp_ctx: &Secp256k1<T>,
677-
) -> Result<Vec<BlindedMessagePath>, ()> {
678-
Self::create_blinded_paths_from_iter(
679-
network_graph,
680-
recipient,
681-
context,
682-
peers.into_iter(),
683-
entropy_source,
684-
secp_ctx,
685-
true,
686-
)
687-
}
688658
}
689659

690660
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref> MessageRouter
@@ -703,27 +673,29 @@ where
703673
&self, recipient: PublicKey, context: MessageContext, peers: Vec<MessageForwardNode>,
704674
secp_ctx: &Secp256k1<T>,
705675
) -> Result<Vec<BlindedMessagePath>, ()> {
706-
Self::create_blinded_paths(
676+
Self::create_blinded_paths_from_iter(
707677
&self.network_graph,
708678
recipient,
709679
context,
710-
peers,
680+
peers.into_iter(),
711681
&self.entropy_source,
712682
secp_ctx,
683+
false,
713684
)
714685
}
715686

716687
fn create_compact_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
717688
&self, recipient: PublicKey, context: MessageContext, peers: Vec<MessageForwardNode>,
718689
secp_ctx: &Secp256k1<T>,
719690
) -> Result<Vec<BlindedMessagePath>, ()> {
720-
Self::create_compact_blinded_paths(
691+
Self::create_blinded_paths_from_iter(
721692
&self.network_graph,
722693
recipient,
723694
context,
724-
peers,
695+
peers.into_iter(),
725696
&self.entropy_source,
726697
secp_ctx,
698+
true,
727699
)
728700
}
729701
}

0 commit comments

Comments
 (0)