@@ -33,7 +33,7 @@ use bitcoin::secp256k1::Secp256k1;
33
33
use bitcoin::{secp256k1, Sequence, Weight};
34
34
35
35
use crate::events::FundingInfo;
36
- use crate::blinded_path::message::{AsyncPaymentsContext, MessageContext, MessageForwardNode, OffersContext };
36
+ use crate::blinded_path::message::{AsyncPaymentsContext, MessageContext, MessageForwardNode};
37
37
use crate::blinded_path::NodeIdLookUp;
38
38
use crate::blinded_path::message::BlindedMessagePath;
39
39
use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints, PaymentContext, UnauthenticatedReceiveTlvs};
@@ -443,11 +443,15 @@ impl Ord for ClaimableHTLC {
443
443
pub trait Verification {
444
444
/// Constructs an HMAC to include in [`OffersContext`] for the data along with the given
445
445
/// [`Nonce`].
446
+ ///
447
+ /// [`OffersContext`]: crate::blinded_path::message::OffersContext
446
448
fn hmac_for_offer_payment(
447
449
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
448
450
) -> Hmac<Sha256>;
449
451
450
452
/// Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`].
453
+ ///
454
+ /// [`OffersContext`]: crate::blinded_path::message::OffersContext
451
455
fn verify_for_offer_payment(
452
456
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
453
457
) -> Result<(), ()>;
@@ -456,6 +460,8 @@ pub trait Verification {
456
460
impl Verification for PaymentHash {
457
461
/// Constructs an HMAC to include in [`OffersContext::InboundPayment`] for the payment hash
458
462
/// along with the given [`Nonce`].
463
+ ///
464
+ /// [`OffersContext::InboundPayment`]: crate::blinded_path::message::OffersContext::InboundPayment
459
465
fn hmac_for_offer_payment(
460
466
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
461
467
) -> Hmac<Sha256> {
@@ -464,6 +470,8 @@ impl Verification for PaymentHash {
464
470
465
471
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
466
472
/// [`OffersContext::InboundPayment`].
473
+ ///
474
+ /// [`OffersContext::InboundPayment`]: crate::blinded_path::message::OffersContext::InboundPayment
467
475
fn verify_for_offer_payment(
468
476
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
469
477
) -> Result<(), ()> {
@@ -518,6 +526,8 @@ impl PaymentId {
518
526
impl Verification for PaymentId {
519
527
/// Constructs an HMAC to include in [`OffersContext::OutboundPayment`] for the payment id
520
528
/// along with the given [`Nonce`].
529
+ ///
530
+ /// [`OffersContext::OutboundPayment`]: crate::blinded_path::message::OffersContext::OutboundPayment
521
531
fn hmac_for_offer_payment(
522
532
&self, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
523
533
) -> Hmac<Sha256> {
@@ -526,6 +536,8 @@ impl Verification for PaymentId {
526
536
527
537
/// Authenticates the payment id using an HMAC and a [`Nonce`] taken from an
528
538
/// [`OffersContext::OutboundPayment`].
539
+ ///
540
+ /// [`OffersContext::OutboundPayment`]: crate::blinded_path::message::OffersContext::OutboundPayment
529
541
fn verify_for_offer_payment(
530
542
&self, hmac: Hmac<Sha256>, nonce: Nonce, expanded_key: &inbound_payment::ExpandedKey,
531
543
) -> Result<(), ()> {
@@ -2030,17 +2042,17 @@ where
2030
2042
/// ```
2031
2043
///
2032
2044
/// ## BOLT 12 Offers
2033
- ///
2045
+ ///
2034
2046
/// For more information on creating offers, see [`create_offer_builder`].
2035
2047
///
2036
2048
/// For details on initiating payments for offers, see [`pay_for_offer`].
2037
2049
///
2038
2050
/// ## BOLT 12 Refunds
2039
- ///
2051
+ ///
2040
2052
/// For more information on creating refunds, see [`create_refund_builder`].
2041
2053
///
2042
2054
/// For requesting refund payments, see [`request_refund_payment`].
2043
- ///
2055
+ ///
2044
2056
/// # Persistence
2045
2057
///
2046
2058
/// Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
@@ -9572,27 +9584,11 @@ where
9572
9584
.collect::<Vec<_>>()
9573
9585
}
9574
9586
9575
- fn verify_bolt12_invoice(
9576
- &self, invoice: &Bolt12Invoice, context: Option<&OffersContext>,
9577
- ) -> Result<PaymentId, ()> {
9578
- let secp_ctx = &self.secp_ctx;
9579
- let expanded_key = &self.inbound_payment_key;
9580
-
9581
- match context {
9582
- None if invoice.is_for_refund_without_paths() => {
9583
- invoice.verify_using_metadata(expanded_key, secp_ctx)
9584
- },
9585
- Some(&OffersContext::OutboundPayment { payment_id, nonce, .. }) => {
9586
- invoice.verify_using_payer_data(payment_id, nonce, expanded_key, secp_ctx)
9587
- },
9588
- _ => Err(()),
9589
- }
9590
- }
9591
-
9592
9587
fn send_payment_for_verified_bolt12_invoice(&self, invoice: &Bolt12Invoice, payment_id: PaymentId) -> Result<(), Bolt12PaymentError> {
9593
9588
let best_block_height = self.best_block.read().unwrap().height;
9594
- let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
9595
9589
let features = self.bolt12_invoice_features();
9590
+ let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
9591
+
9596
9592
self.pending_outbound_payments
9597
9593
.send_payment_for_bolt12_invoice(
9598
9594
invoice, payment_id, &self.router, self.list_usable_channels(), features,
0 commit comments