Introduce ResponseInstructions for OnionMessage Handling
authorshaavan <shaavan.github@gmail.com>
Mon, 25 Mar 2024 08:42:47 +0000 (14:12 +0530)
committershaavan <shaavan.github@gmail.com>
Fri, 3 May 2024 11:56:19 +0000 (17:26 +0530)
commite640951f9532a0b90099e04bca03db37e115ee1c
treed56da96b917d9b8e071100f5c483dfea72a884a5
parentbd3cc003bb1856ee3707c79b04e2456c19e3dd76
Introduce ResponseInstructions for OnionMessage Handling

- Currently, handle_message (or handle_custom_message) only exposes
  the generated response for an OnionMessage, lacking the necessary
  reply_path for asynchronous responses.

- This commit introduces a new flow for OnionMessage handling.

- Instead of solely taking the message as input, handle_message now accepts
  an Optional `responder`, returning a `ResponseInstruction` containing both
  the response and the reply_path.

- `ResponseInstruction` utilizes different enum variants to indicate how
  `handle_onion_message_response` should handle the response.

- This enhancement enables exposing the reply_path alongside the response
  and allows for more complex response mechanisms, such as responding with
  an added reply_path.

- The commit introduces the foundational framework (structs & enums) for this new flow.
lightning/src/onion_message/messenger.rs