Skip to content

Commit

Permalink
chore: update LDK (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 authored Feb 17, 2025
1 parent 75d95b0 commit a11ba5a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
43 changes: 24 additions & 19 deletions internal/lightning/lib/bolt12/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/lightning/lib/bolt12/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crate-type = ["cdylib", "staticlib"]

[dependencies]
bech32 = { version = "0.9.1", default-features = false }
lightning = { version = "0.0.124", features = ["no-std"], default-features = false }
lightning = { version = "0.1.1", default-features = false }

[profile.release]
# Tell `rustc` to optimize for small code size.
Expand Down
15 changes: 6 additions & 9 deletions internal/lightning/lib/bolt12/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<T> CResult<T> {
},
Err(err) => CResult {
result: null(),
error: CString::new(err).unwrap_or(CString::default()).into_raw(),
error: CString::new(err).unwrap_or_default().into_raw(),
},
}
}
Expand Down Expand Up @@ -97,13 +97,10 @@ fn parse_invoice(invoice: *const c_char) -> Result<Bolt12Invoice, String> {

#[no_mangle]
pub unsafe extern "C" fn decode_invoice(invoice: *const c_char) -> CResult<Invoice> {
CResult::from_result(parse_invoice(invoice).map(|invoice| {
Invoice {
amount_sat: convert_msats_to_sats(invoice.amount_msats()),
payment_hash: invoice.payment_hash().0,
expiry_date: (invoice.created_at()
+ invoice.relative_expiry()).as_secs(),
}
CResult::from_result(parse_invoice(invoice).map(|invoice| Invoice {
amount_sat: convert_msats_to_sats(invoice.amount_msats()),
payment_hash: invoice.payment_hash().0,
expiry_date: (invoice.created_at() + invoice.relative_expiry()).as_secs(),
}))
}

Expand All @@ -126,7 +123,7 @@ pub unsafe extern "C" fn check_invoice_is_for_offer(
possible_signers.push(last_signer.blinded_node_id);
}
});
if let Some(signer) = offer.signing_pubkey() {
if let Some(signer) = offer.issuer_signing_pubkey() {
possible_signers.push(signer);
}
possible_signers.contains(&invoice.signing_pubkey())
Expand Down

0 comments on commit a11ba5a

Please sign in to comment.