) -> Result<(), Bolt12PaymentError> {
let mut res = Ok(());
PersistenceNotifierGuard::optionally_notify(self, || {
+ let features = self.bolt12_invoice_features();
let outbound_pmts_res = self.pending_outbound_payments.static_invoice_received(
- invoice, payment_id, &*self.entropy_source, &self.pending_events
+ invoice, payment_id, features, &*self.entropy_source, &self.pending_events
);
let payment_release_secret = match outbound_pmts_res {
Ok(secret) => secret,
#[cfg(async_payments)]
pub(super) fn static_invoice_received<ES: Deref>(
- &self, invoice: &StaticInvoice, payment_id: PaymentId, entropy_source: ES,
+ &self, invoice: &StaticInvoice, payment_id: PaymentId, features: Bolt12InvoiceFeatures,
+ entropy_source: ES,
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>
) -> Result<[u8; 32], Bolt12PaymentError> where ES::Target: EntropySource {
macro_rules! abandon_with_entry {
if !invoice.from_same_offer(invreq) {
return Err(Bolt12PaymentError::UnexpectedInvoice)
}
+ if invoice.invoice_features().requires_unknown_bits_from(&features) {
+ abandon_with_entry!(entry, PaymentFailureReason::UnknownRequiredFeatures);
+ return Err(Bolt12PaymentError::UnknownRequiredFeatures)
+ }
let amount_msat = match InvoiceBuilder::<DerivedSigningPubkey>::amount_msats(invreq) {
Ok(amt) => amt,
Err(_) => {