Skip to content

Commit

Permalink
f Account for Invoice being renamed to Bolt11Invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Jul 24, 2023
1 parent 23a64aa commit 4bed243
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//!
//! ```no_run
//! use ldk_node::{Builder, NetAddress};
//! use ldk_node::lightning_invoice::Invoice;
//! use ldk_node::lightning_invoice::Bolt11Invoice;
//! use ldk_node::bitcoin::secp256k1::PublicKey;
//! use ldk_node::bitcoin::Network;
//! use std::str::FromStr;
Expand All @@ -54,7 +54,7 @@
//! println!("EVENT: {:?}", event);
//! node.event_handled();
//!
//! let invoice = Invoice::from_str("INVOICE_STR").unwrap();
//! let invoice = Bolt11Invoice::from_str("INVOICE_STR").unwrap();
//! node.send_payment(&invoice).unwrap();
//!
//! node.stop().unwrap();
Expand Down Expand Up @@ -137,7 +137,7 @@ use lightning_background_processor::process_events_async;
use lightning_transaction_sync::EsploraSyncClient;

use lightning::routing::router::{PaymentParameters, RouteParameters};
use lightning_invoice::{payment, Currency, Invoice};
use lightning_invoice::{payment, Bolt11Invoice, Currency};

use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash;
Expand Down Expand Up @@ -1036,7 +1036,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
}

/// Send a payement given an invoice.
pub fn send_payment(&self, invoice: &Invoice) -> Result<PaymentHash, Error> {
pub fn send_payment(&self, invoice: &Bolt11Invoice) -> Result<PaymentHash, Error> {
let rt_lock = self.runtime.read().unwrap();
if rt_lock.is_none() {
return Err(Error::NotRunning);
Expand Down Expand Up @@ -1112,7 +1112,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
/// This can be used to pay a so-called "zero-amount" invoice, i.e., an invoice that leaves the
/// amount paid to be determined by the user.
pub fn send_payment_using_amount(
&self, invoice: &Invoice, amount_msat: u64,
&self, invoice: &Bolt11Invoice, amount_msat: u64,
) -> Result<PaymentHash, Error> {
let rt_lock = self.runtime.read().unwrap();
if rt_lock.is_none() {
Expand Down Expand Up @@ -1294,21 +1294,21 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
/// given.
pub fn receive_payment(
&self, amount_msat: u64, description: &str, expiry_secs: u32,
) -> Result<Invoice, Error> {
) -> Result<Bolt11Invoice, Error> {
self.receive_payment_inner(Some(amount_msat), description, expiry_secs)
}

/// Returns a payable invoice that can be used to request and receive a payment for which the
/// amount is to be determined by the user, also known as a "zero-amount" invoice.
pub fn receive_variable_amount_payment(
&self, description: &str, expiry_secs: u32,
) -> Result<Invoice, Error> {
) -> Result<Bolt11Invoice, Error> {
self.receive_payment_inner(None, description, expiry_secs)
}

fn receive_payment_inner(
&self, amount_msat: Option<u64>, description: &str, expiry_secs: u32,
) -> Result<Invoice, Error> {
) -> Result<Bolt11Invoice, Error> {
let currency = Currency::from(self.config.network);
let keys_manager = Arc::clone(&self.keys_manager);
let invoice = match lightning_invoice::utils::create_invoice_from_channelmanager(
Expand Down

0 comments on commit 4bed243

Please sign in to comment.