@@ -497,6 +497,8 @@ struct establishing_paths {
497497 int which_blinded_path ;
498498 struct sent * sent ;
499499 struct tlv_onionmsg_tlv * final_tlv ;
500+ /* Do we want a reply? */
501+ bool want_reply ;
500502 struct command_result * (* done )(struct command * cmd ,
501503 const char * method UNUSED ,
502504 const char * buf UNUSED ,
@@ -526,12 +528,14 @@ static struct command_result *establish_path_done(struct command *cmd,
526528 assert (tal_count (path ) > 0 );
527529
528530 /* Add reply path to final_tlv (it already contains invoice_request/invoice) */
529- final_tlv -> reply_path = make_reply_path (final_tlv , cmd -> plugin , sent , path , sent -> reply_secret );
531+ if (epaths -> want_reply ) {
532+ final_tlv -> reply_path = make_reply_path (final_tlv , cmd -> plugin , sent , path , sent -> reply_secret );
530533
531- /* Replace first hop with scidd if they said to */
532- if (sent -> dev_path_use_scidd )
533- sciddir_or_pubkey_from_scidd (& final_tlv -> reply_path -> first_node_id ,
534- sent -> dev_path_use_scidd );
534+ /* Replace first hop with scidd if they said to */
535+ if (sent -> dev_path_use_scidd )
536+ sciddir_or_pubkey_from_scidd (& final_tlv -> reply_path -> first_node_id ,
537+ sent -> dev_path_use_scidd );
538+ }
535539
536540 /* Put in list so we recognize reply onion message. Note: because
537541 * onion message notification comes from a different fd than the one
@@ -608,6 +612,7 @@ static struct command_result *try_establish(struct command *cmd,
608612
609613static struct command_result * send_message (struct command * cmd ,
610614 struct sent * sent ,
615+ bool want_reply ,
611616 struct tlv_onionmsg_tlv * final_tlv STEALS ,
612617 struct command_result * (* done )
613618 (struct command * cmd ,
@@ -622,6 +627,7 @@ static struct command_result *send_message(struct command *cmd,
622627 epaths -> sent = sent ;
623628 epaths -> final_tlv = tal_steal (epaths , final_tlv );
624629 epaths -> done = done ;
630+ epaths -> want_reply = want_reply ;
625631
626632 return try_establish (cmd , epaths );
627633}
@@ -762,7 +768,7 @@ static struct command_result *invreq_done(struct command *cmd,
762768 payload -> invoice_request = tal_arr (payload , u8 , 0 );
763769 towire_tlv_invoice_request (& payload -> invoice_request , sent -> invreq );
764770
765- return send_message (cmd , sent , payload , sendonionmsg_done );
771+ return send_message (cmd , sent , true, payload , sendonionmsg_done );
766772}
767773
768774static struct command_result * param_dev_scidd (struct command * cmd , const char * name ,
@@ -1222,7 +1228,7 @@ static struct command_result *createinvoice_done(struct command *cmd,
12221228 payload -> invoice = tal_arr (payload , u8 , 0 );
12231229 towire_tlv_invoice (& payload -> invoice , sent -> inv );
12241230
1225- return send_message (cmd , sent , payload , prepare_inv_timeout );
1231+ return send_message (cmd , sent , true, payload , prepare_inv_timeout );
12261232}
12271233
12281234static struct command_result * sign_invoice (struct command * cmd ,
@@ -1515,5 +1521,5 @@ struct command_result *json_dev_rawrequest(struct command *cmd,
15151521 payload -> invoice_request = tal_arr (payload , u8 , 0 );
15161522 towire_tlv_invoice_request (& payload -> invoice_request , sent -> invreq );
15171523
1518- return send_message (cmd , sent , payload , sendonionmsg_done );
1524+ return send_message (cmd , sent , true, payload , sendonionmsg_done );
15191525}
0 commit comments