Skip to content

Commit

Permalink
Add reply_path to BOLT12Invoices in Offers Flow
Browse files Browse the repository at this point in the history
1. Introduced reply_path in BOLT12Invoices to address a gap in error handling.
   Previously, if a BOLT12Invoice sent in the offers flow generated an Invoice Error,
   the payer had no way to send this error back to the payee.
2. By adding a reply_path to the Invoice Message, the payer can now communicate
   any errors back to the payee, ensuring better error handling and communication
   within the offers flow.
  • Loading branch information
shaavan committed Sep 9, 2024
1 parent 105189d commit b75dbe1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10893,7 +10893,12 @@ where
};

match response {
Ok(invoice) => Some((OffersMessage::Invoice(invoice), responder.respond())),
Ok(invoice) => {
let nonce = nonce.unwrap_or_else(|| Nonce::from_entropy_source(&*self.entropy_source));
let hmac = signer::hmac_for_payment_hash(payment_hash, nonce, expanded_key);
let context = MessageContext::Offers(OffersContext::InboundPayment { payment_hash, nonce, hmac });
Some((OffersMessage::Invoice(invoice), responder.respond_with_reply_path(context)))
},
Err(error) => Some((OffersMessage::InvoiceError(error.into()), responder.respond())),
}
},
Expand Down

0 comments on commit b75dbe1

Please sign in to comment.