From b84d8b89f1c2beba5970228302e4c10e6a6a629b Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Fri, 7 Jul 2023 15:40:55 +0200 Subject: [PATCH] f Account for `send_onion_message` taking dedicated types --- src/cli.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index a2546d71..efebb75d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -11,6 +11,7 @@ use bitcoin::secp256k1::PublicKey; use lightning::ln::channelmanager::{PaymentId, RecipientOnionFields, Retry}; use lightning::ln::msgs::NetAddress; use lightning::ln::{PaymentHash, PaymentPreimage}; +use lightning::onion_message::OnionMessagePath; use lightning::onion_message::{CustomOnionMessageContents, Destination, OnionMessageContents}; use lightning::routing::gossip::NodeId; use lightning::routing::router::{PaymentParameters, RouteParameters}; @@ -377,7 +378,7 @@ pub(crate) async fn poll_for_user_input( ); continue; } - let mut node_pks = Vec::new(); + let mut intermediate_nodes = Vec::new(); let mut errored = false; for pk_str in path_pks_str.unwrap().split(",") { let node_pubkey_vec = match hex_utils::to_vec(pk_str) { @@ -396,7 +397,7 @@ pub(crate) async fn poll_for_user_input( break; } }; - node_pks.push(node_pubkey); + intermediate_nodes.push(node_pubkey); } if errored { continue; @@ -415,10 +416,10 @@ pub(crate) async fn poll_for_user_input( continue; } }; - let destination_pk = node_pks.pop().unwrap(); + let destination = Destination::Node(intermediate_nodes.pop().unwrap()); + let message_path = OnionMessagePath { intermediate_nodes, destination }; match onion_messenger.send_onion_message( - &node_pks, - Destination::Node(destination_pk), + message_path, OnionMessageContents::Custom(UserOnionMessageContents { tlv_type, data }), None, ) {