Skip to content

Commit

Permalink
Validate the invoice network when sending payments
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Nov 13, 2023
1 parent af67ee9 commit 1510a1b
Show file tree
Hide file tree
Showing 18 changed files with 832 additions and 514 deletions.
3 changes: 3 additions & 0 deletions libs/sdk-bindings/src/breez_sdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum LnUrlPayError {
"Generic",
"InvalidAmount",
"InvalidInvoice",
"InvalidNetwork",
"InvalidUri",
"InvoiceExpired",
"PaymentFailed",
Expand Down Expand Up @@ -81,6 +82,7 @@ enum SendPaymentError {
"InvalidAmount",
"InvalidInvoice",
"InvoiceExpired",
"InvalidNetwork",
"PaymentFailed",
"PaymentTimeout",
"RouteNotFound",
Expand Down Expand Up @@ -134,6 +136,7 @@ dictionary RouteHint {

dictionary LNInvoice {
string bolt11;
Network network;
string payee_pubkey;
string payment_hash;
string? description;
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-bindings/src/uniffi_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl BlockingBreezServices {
}

pub fn parse_invoice(invoice: String) -> SdkResult<LNInvoice> {
Ok(sdk_parse_invoice(&invoice)?)
Ok(sdk_parse_invoice(&invoice, None)?)
}

pub fn parse_input(s: String) -> SdkResult<InputType> {
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-core/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pub fn backup_status() -> Result<BackupStatus> {
/* Parse API's */

pub fn parse_invoice(invoice: String) -> Result<LNInvoice> {
invoice::parse_invoice(&invoice).map_err(|e| anyhow::Error::new::<SdkError>(e.into()))
invoice::parse_invoice(&invoice, None).map_err(|e| anyhow::Error::new::<SdkError>(e.into()))
}

pub fn parse_input(input: String) -> Result<InputType> {
Expand Down
Loading

0 comments on commit 1510a1b

Please sign in to comment.