Skip to content

Commit d9c4f75

Browse files
committed
f Account for BOLT12 PaymentPurpose variants
1 parent 426d73a commit d9c4f75

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

src/event.rs

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ where
474474
amount_msat,
475475
);
476476
let payment_preimage = match purpose {
477-
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret } => {
477+
PaymentPurpose::Bolt11InvoicePayment { payment_preimage, payment_secret } => {
478478
if payment_preimage.is_some() {
479479
payment_preimage
480480
} else {
@@ -483,6 +483,26 @@ where
483483
.ok()
484484
}
485485
},
486+
PaymentPurpose::Bolt12OfferPayment { .. } => {
487+
// TODO: support BOLT12.
488+
log_error!(
489+
self.logger,
490+
"Failed to claim unsupported BOLT12 payment with hash: {}",
491+
payment_hash
492+
);
493+
self.channel_manager.fail_htlc_backwards(&payment_hash);
494+
return;
495+
},
496+
PaymentPurpose::Bolt12RefundPayment { .. } => {
497+
// TODO: support BOLT12.
498+
log_error!(
499+
self.logger,
500+
"Failed to claim unsupported BOLT12 payment with hash: {}",
501+
payment_hash
502+
);
503+
self.channel_manager.fail_htlc_backwards(&payment_hash);
504+
return;
505+
},
486506
PaymentPurpose::SpontaneousPayment(preimage) => Some(preimage),
487507
};
488508

@@ -521,7 +541,11 @@ where
521541
amount_msat,
522542
);
523543
match purpose {
524-
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
544+
PaymentPurpose::Bolt11InvoicePayment {
545+
payment_preimage,
546+
payment_secret,
547+
..
548+
} => {
525549
let update = PaymentDetailsUpdate {
526550
preimage: Some(payment_preimage),
527551
secret: Some(Some(payment_secret)),
@@ -550,6 +574,24 @@ where
550574
},
551575
}
552576
},
577+
PaymentPurpose::Bolt12OfferPayment { .. } => {
578+
// TODO: support BOLT12.
579+
log_error!(
580+
self.logger,
581+
"Failed to claim unsupported BOLT12 payment with hash: {}",
582+
payment_hash
583+
);
584+
return;
585+
},
586+
PaymentPurpose::Bolt12RefundPayment { .. } => {
587+
// TODO: support BOLT12.
588+
log_error!(
589+
self.logger,
590+
"Failed to claim unsupported BOLT12 payment with hash: {}",
591+
payment_hash
592+
);
593+
return;
594+
},
553595
PaymentPurpose::SpontaneousPayment(preimage) => {
554596
let payment = PaymentDetails {
555597
preimage: Some(preimage),

0 commit comments

Comments
 (0)