diff --git a/crates/cdk-phoenixd/src/error.rs b/crates/cdk-phoenixd/src/error.rs index 5e7367bb8..8eaf60efd 100644 --- a/crates/cdk-phoenixd/src/error.rs +++ b/crates/cdk-phoenixd/src/error.rs @@ -11,6 +11,9 @@ pub enum Error { /// Unknown invoice #[error("Unknown invoice")] UnknownInvoice, + /// Unsupported unit + #[error("Unit Unsupported")] + UnsupportedUnit, /// Anyhow error #[error(transparent)] Anyhow(#[from] anyhow::Error), diff --git a/crates/cdk-phoenixd/src/lib.rs b/crates/cdk-phoenixd/src/lib.rs index 3b6b5dab5..659b213d6 100644 --- a/crates/cdk-phoenixd/src/lib.rs +++ b/crates/cdk-phoenixd/src/lib.rs @@ -123,6 +123,10 @@ impl MintLightning for Phoenixd { &self, melt_quote_request: &MeltQuoteBolt11Request, ) -> Result { + if CurrencyUnit::Sat != melt_quote_request.unit { + return Err(Error::UnsupportedUnit.into()); + } + let invoice_amount_msat = melt_quote_request .request .amount_milli_satoshis() @@ -130,7 +134,7 @@ impl MintLightning for Phoenixd { let amount = to_unit( invoice_amount_msat, - &CurrencyUnit::Sat, + &CurrencyUnit::Msat, &melt_quote_request.unit, )?;