From 63933d14b7d88d7760a9d3dd92377ce35061c438 Mon Sep 17 00:00:00 2001 From: Ian Slane Date: Sun, 21 Jul 2024 16:31:03 -0600 Subject: [PATCH] Update `request_refund_payment` to use `Bolt12CreationError` Updated request_refund_payment method in ChannelManager to replace Bolt12SemanticError with Bolt12CreationError. --- lightning/src/ln/channelmanager.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 45ca35faaad..6ce3fc24d74 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -8969,7 +8969,7 @@ where /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice pub fn request_refund_payment( &self, refund: &Refund - ) -> Result { + ) -> Result { let expanded_key = &self.inbound_payment_key; let entropy = &*self.entropy_source; let secp_ctx = &self.secp_ctx; @@ -8978,7 +8978,7 @@ where let relative_expiry = DEFAULT_RELATIVE_EXPIRY.as_secs() as u32; if refund.chain() != self.chain_hash { - return Err(Bolt12SemanticError::UnsupportedChain); + return Err(Bolt12CreationError::InvalidSemantics(Bolt12SemanticError::UnsupportedChain)); } let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self); @@ -8989,7 +8989,7 @@ where let payment_paths = self.create_blinded_payment_paths( amount_msats, payment_secret, payment_context ) - .map_err(|_| Bolt12SemanticError::MissingPaths)?; + .map_err(|_| Bolt12CreationError::InvalidSemantics(Bolt12SemanticError::MissingPaths))?; #[cfg(feature = "std")] let builder = refund.respond_using_derived_keys( @@ -9006,7 +9006,7 @@ where let builder: InvoiceBuilder = builder.into(); let invoice = builder.allow_mpp().build_and_sign(secp_ctx)?; let reply_paths = self.create_blinded_paths(OffersContext::Unknown {}) - .map_err(|_| Bolt12SemanticError::MissingPaths)?; + .map_err(|_| Bolt12CreationError::InvalidSemantics(Bolt12SemanticError::MissingPaths))?; let mut pending_offers_messages = self.pending_offers_messages.lock().unwrap(); if refund.paths().is_empty() { @@ -9035,7 +9035,7 @@ where Ok(invoice) }, - Err(()) => Err(Bolt12SemanticError::InvalidAmount), + Err(()) => Err(Bolt12CreationError::InvalidSemantics(Bolt12SemanticError::InvalidAmount)), } }