Skip to content

Commit 95dad2c

Browse files
committed
Add reply_path to BOLT12Invoices in Offers Flow
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.
1 parent 47be9fe commit 95dad2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10893,7 +10893,12 @@ where
1089310893
};
1089410894

1089510895
match response {
10896-
Ok(invoice) => Some((OffersMessage::Invoice(invoice), responder.respond())),
10896+
Ok(invoice) => {
10897+
let nonce = nonce.unwrap_or_else(|| Nonce::from_entropy_source(&*self.entropy_source));
10898+
let hmac = signer::hmac_for_payment_hash(payment_hash, nonce, expanded_key);
10899+
let context = MessageContext::Offers(OffersContext::InboundPayment { payment_hash, nonce, hmac });
10900+
Some((OffersMessage::Invoice(invoice), responder.respond_with_reply_path(context)))
10901+
},
1089710902
Err(error) => Some((OffersMessage::InvoiceError(error.into()), responder.respond())),
1089810903
}
1089910904
},

0 commit comments

Comments
 (0)