Skip to content

Commit c065a80

Browse files
committed
Avoid options holding references in the public API
1 parent 82347ec commit c065a80

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lightning/src/ln/async_payments_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ fn ignore_duplicate_invoice() {
996996
match sender.onion_messenger.peel_onion_message(&invoice_om) {
997997
Ok(PeeledOnion::Offers(OffersMessage::Invoice(invoice), context, _)) => {
998998
assert!(matches!(
999-
sender.node.send_payment_for_bolt12_invoice(&invoice, context.as_ref()),
999+
sender.node.send_payment_for_bolt12_invoice(&invoice, context),
10001000
Err(Bolt12PaymentError::DuplicateInvoice)
10011001
))
10021002
},

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5568,9 +5568,9 @@ where
55685568
///
55695569
/// [timer tick]: Self::timer_tick_occurred
55705570
pub fn send_payment_for_bolt12_invoice(
5571-
&self, invoice: &Bolt12Invoice, context: Option<&OffersContext>,
5571+
&self, invoice: &Bolt12Invoice, context: Option<OffersContext>,
55725572
) -> Result<(), Bolt12PaymentError> {
5573-
match self.verify_bolt12_invoice(invoice, context) {
5573+
match self.verify_bolt12_invoice(invoice, context.as_ref()) {
55745574
Ok(payment_id) => self.send_payment_for_verified_bolt12_invoice(invoice, payment_id),
55755575
Err(()) => Err(Bolt12PaymentError::UnexpectedInvoice),
55765576
}

lightning/src/ln/offers_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,9 +1321,9 @@ fn pays_bolt12_invoice_asynchronously() {
13211321
assert_eq!(path.introduction_node(), &IntroductionNode::NodeId(alice_id));
13221322
}
13231323

1324-
assert!(bob.node.send_payment_for_bolt12_invoice(&invoice, context.as_ref()).is_ok());
1324+
assert!(bob.node.send_payment_for_bolt12_invoice(&invoice, context.clone()).is_ok());
13251325
assert_eq!(
1326-
bob.node.send_payment_for_bolt12_invoice(&invoice, context.as_ref()),
1326+
bob.node.send_payment_for_bolt12_invoice(&invoice, context.clone()),
13271327
Err(Bolt12PaymentError::DuplicateInvoice),
13281328
);
13291329

@@ -1334,7 +1334,7 @@ fn pays_bolt12_invoice_asynchronously() {
13341334
expect_recent_payment!(bob, RecentPaymentDetails::Fulfilled, payment_id);
13351335

13361336
assert_eq!(
1337-
bob.node.send_payment_for_bolt12_invoice(&invoice, context.as_ref()),
1337+
bob.node.send_payment_for_bolt12_invoice(&invoice, context.clone()),
13381338
Err(Bolt12PaymentError::DuplicateInvoice),
13391339
);
13401340

@@ -1343,7 +1343,7 @@ fn pays_bolt12_invoice_asynchronously() {
13431343
}
13441344

13451345
assert_eq!(
1346-
bob.node.send_payment_for_bolt12_invoice(&invoice, context.as_ref()),
1346+
bob.node.send_payment_for_bolt12_invoice(&invoice, context),
13471347
Err(Bolt12PaymentError::UnexpectedInvoice),
13481348
);
13491349
}

0 commit comments

Comments
 (0)