@@ -1946,12 +1946,13 @@ where
19461946/// ```
19471947/// # use core::time::Duration;
19481948/// # use lightning::events::{Event, EventsProvider};
1949- /// # use lightning::ln::channelmanager::{AChannelManager, Bolt12CreationError, PaymentId, RecentPaymentDetails, Retry};
1949+ /// # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry};
1950+ /// # use lightning::offers::parse::Bolt12SemanticError;
19501951/// #
19511952/// # fn example<T: AChannelManager>(
19521953/// # channel_manager: T, amount_msats: u64, absolute_expiry: Duration, retry: Retry,
19531954/// # max_total_routing_fee_msat: Option<u64>
1954- /// # ) -> Result<(), Bolt12CreationError > {
1955+ /// # ) -> Result<(), Bolt12SemanticError > {
19551956/// # let channel_manager = channel_manager.get_cm();
19561957/// let payment_id = PaymentId([42; 32]);
19571958/// let refund = channel_manager
@@ -2688,10 +2689,6 @@ pub enum RecentPaymentDetails {
26882689pub enum Bolt12CreationError {
26892690 /// Error from BOLT 12 semantic checks.
26902691 InvalidSemantics(Bolt12SemanticError),
2691- /// The payment id for a refund or request is already in use.
2692- DuplicatePaymentId,
2693- /// There is insufficient liquidity to complete the payment.
2694- InsufficientLiquidity,
26952692 /// Failed to create a blinded path.
26962693 BlindedPathCreationFailed,
26972694}
@@ -9205,7 +9202,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
92059202 pub fn create_refund_builder(
92069203 &$self, amount_msats: u64, absolute_expiry: Duration, payment_id: PaymentId,
92079204 retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>
9208- ) -> Result<$builder, Bolt12CreationError > {
9205+ ) -> Result<$builder, Bolt12SemanticError > {
92099206 let node_id = $self.get_our_node_id();
92109207 let expanded_key = &$self.inbound_payment_key;
92119208 let entropy = &*$self.entropy_source;
@@ -9215,7 +9212,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
92159212 let context = OffersContext::OutboundPayment { payment_id, nonce, hmac: None };
92169213 let path = $self.create_blinded_paths_using_absolute_expiry(context, Some(absolute_expiry))
92179214 .and_then(|paths| paths.into_iter().next().ok_or(()))
9218- .map_err(|()| Bolt12CreationError::BlindedPathCreationFailed )?;
9215+ .map_err(|_| Bolt12SemanticError::MissingPaths )?;
92199216
92209217 let builder = RefundBuilder::deriving_signing_pubkey(
92219218 node_id, expanded_key, nonce, secp_ctx, amount_msats, payment_id
@@ -9231,7 +9228,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
92319228 .add_new_awaiting_invoice(
92329229 payment_id, expiration, retry_strategy, max_total_routing_fee_msat, None,
92339230 )
9234- .map_err(|()| Bolt12CreationError ::DuplicatePaymentId)?;
9231+ .map_err(|_| Bolt12SemanticError ::DuplicatePaymentId)?;
92359232
92369233 Ok(builder.into())
92379234 }
@@ -9323,7 +9320,7 @@ where
93239320 &self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
93249321 payer_note: Option<String>, payment_id: PaymentId, retry_strategy: Retry,
93259322 max_total_routing_fee_msat: Option<u64>
9326- ) -> Result<(), Bolt12CreationError > {
9323+ ) -> Result<(), Bolt12SemanticError > {
93279324 let expanded_key = &self.inbound_payment_key;
93289325 let entropy = &*self.entropy_source;
93299326 let secp_ctx = &self.secp_ctx;
@@ -9353,7 +9350,7 @@ where
93539350 OffersContext::OutboundPayment { payment_id, nonce, hmac: Some(hmac) }
93549351 );
93559352 let reply_paths = self.create_blinded_paths(context)
9356- .map_err(|()| Bolt12CreationError::BlindedPathCreationFailed )?;
9353+ .map_err(|_| Bolt12SemanticError::MissingPaths )?;
93579354
93589355 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
93599356
@@ -9367,7 +9364,7 @@ where
93679364 payment_id, expiration, retry_strategy, max_total_routing_fee_msat,
93689365 Some(retryable_invoice_request)
93699366 )
9370- .map_err(|()| Bolt12CreationError ::DuplicatePaymentId)?;
9367+ .map_err(|_| Bolt12SemanticError ::DuplicatePaymentId)?;
93719368
93729369 self.enqueue_invoice_request(invoice_request, reply_paths)?;
93739370 Ok(())
0 commit comments