Function create_onion_message
pub fn create_onion_message<ES, NS, NL, T>(
entropy_source: &ES,
node_signer: &NS,
node_id_lookup: &NL,
secp_ctx: &Secp256k1<All>,
path: OnionMessagePath,
contents: T,
reply_path: Option<BlindedMessagePath>,
) -> Result<(PublicKey, OnionMessage, Option<Vec<SocketAddress>>), SendError>where
ES: Deref,
NS: Deref,
NL: Deref,
T: OnionMessageContents,
<ES as Deref>::Target: EntropySource,
<NS as Deref>::Target: NodeSigner,
<NL as Deref>::Target: NodeIdLookUp,
Expand description
Creates an OnionMessage
with the given contents
for sending to the destination of
path
.
Returns the node id of the peer to send the message to, the message itself, and any addresses needed to connect to the first node.
Returns SendError::UnresolvedIntroductionNode
if:
destination
contains a blinded path with anIntroductionNode::DirectedShortChannelId
,- unless it can be resolved by
NodeIdLookUp::next_node_id
. Usecreate_onion_message_resolving_destination
instead to resolve the introduction node first with aReadOnlyNetworkGraph
.