]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Implement Readable for Responder
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 21 May 2024 19:32:40 +0000 (14:32 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 11 Jun 2024 16:05:32 +0000 (11:05 -0500)
A future InvoiceReceived event will include a Responder. Since Event
implements Readable, so must Responder.

lightning/src/onion_message/messenger.rs

index ee49d00e99dea2de48c8a9c2fa76e92c2c2b9b27..0fb72c52d2784a03973bfb3ac2bbf846fc3daba6 100644 (file)
@@ -325,12 +325,18 @@ impl OnionMessageRecipient {
 
 /// The `Responder` struct creates an appropriate [`ResponseInstruction`]
 /// for responding to a message.
+#[derive(Clone, Debug, Eq, PartialEq)]
 pub struct Responder {
        /// The path along which a response can be sent.
        reply_path: BlindedPath,
        path_id: Option<[u8; 32]>
 }
 
+impl_writeable_tlv_based!(Responder, {
+       (0, reply_path, required),
+       (2, path_id, option),
+});
+
 impl Responder {
        /// Creates a new [`Responder`] instance with the provided reply path.
        pub(super) fn new(reply_path: BlindedPath, path_id: Option<[u8; 32]>) -> Self {