Skip to content

Commit cfac29f

Browse files
committed
Add quantity param to send_using_amount
1 parent 8d58464 commit cfac29f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

bindings/ldk_node.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ interface Bolt12Payment {
122122
[Throws=NodeError]
123123
PaymentId send([ByRef]Offer offer, u64? quantity, string? payer_note);
124124
[Throws=NodeError]
125-
PaymentId send_using_amount([ByRef]Offer offer, string? payer_note, u64 amount_msat);
125+
PaymentId send_using_amount([ByRef]Offer offer, u64? quantity, string? payer_note, u64 amount_msat);
126126
[Throws=NodeError]
127127
Offer receive(u64 amount_msat, [ByRef]string description);
128128
[Throws=NodeError]

src/payment/bolt12.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,13 @@ impl Bolt12Payment {
150150
/// If `payer_note` is `Some` it will be seen by the recipient and reflected back in the invoice
151151
/// response.
152152
pub fn send_using_amount(
153-
&self, offer: &Offer, payer_note: Option<String>, amount_msat: u64,
153+
&self, offer: &Offer, quantity: Option<u64>, payer_note: Option<String>, amount_msat: u64,
154154
) -> Result<PaymentId, Error> {
155155
let rt_lock = self.runtime.read().unwrap();
156156
if rt_lock.is_none() {
157157
return Err(Error::NotRunning);
158158
}
159159

160-
let quantity = None;
161160
let mut random_bytes = [0u8; 32];
162161
rand::thread_rng().fill_bytes(&mut random_bytes);
163162
let payment_id = PaymentId(random_bytes);

tests/integration_tests_rust.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,12 @@ fn simple_bolt12_send_receive() {
467467
let offer = node_b.bolt12_payment().receive(offer_amount_msat, "asdf").unwrap();
468468
assert!(node_a
469469
.bolt12_payment()
470-
.send_using_amount(&offer, None, less_than_offer_amount)
470+
.send_using_amount(&offer, None, None, less_than_offer_amount)
471471
.is_err());
472-
let payment_id =
473-
node_a.bolt12_payment().send_using_amount(&offer, None, expected_amount_msat).unwrap();
472+
let payment_id = node_a
473+
.bolt12_payment()
474+
.send_using_amount(&offer, None, None, expected_amount_msat)
475+
.unwrap();
474476

475477
expect_payment_successful_event!(node_a, Some(payment_id), None);
476478
let node_a_payments = node_a.list_payments_with_filter(|p| p.id == payment_id);

0 commit comments

Comments
 (0)