|
64 | 64 | //! # impl Payer for FakePayer { |
65 | 65 | //! # fn node_id(&self) -> PublicKey { unimplemented!() } |
66 | 66 | //! # fn first_hops(&self) -> Vec<ChannelDetails> { unimplemented!() } |
67 | | -//! # fn send_payment( |
68 | | -//! # &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret> |
| 67 | +//! # fn send_payment(&self, route: &Route, payment_hash: PaymentHash, |
| 68 | +//! # payment_secret: &Option<PaymentSecret>, payment_metadata: Option<Vec<u8>> |
69 | 69 | //! # ) -> Result<PaymentId, PaymentSendFailure> { unimplemented!() } |
70 | 70 | //! # fn send_spontaneous_payment( |
71 | 71 | //! # &self, route: &Route, payment_preimage: PaymentPreimage |
@@ -186,8 +186,8 @@ pub trait Payer { |
186 | 186 | fn first_hops(&self) -> Vec<ChannelDetails>; |
187 | 187 |
|
188 | 188 | /// Sends a payment over the Lightning Network using the given [`Route`]. |
189 | | - fn send_payment( |
190 | | - &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret> |
| 189 | + fn send_payment(&self, route: &Route, payment_hash: PaymentHash, |
| 190 | + payment_secret: &Option<PaymentSecret>, payment_metadata: Option<Vec<u8>> |
191 | 191 | ) -> Result<PaymentId, PaymentSendFailure>; |
192 | 192 |
|
193 | 193 | /// Sends a spontaneous payment over the Lightning Network using the given [`Route`]. |
@@ -309,7 +309,7 @@ where |
309 | 309 | }; |
310 | 310 |
|
311 | 311 | let send_payment = |route: &Route| { |
312 | | - self.payer.send_payment(route, payment_hash, &payment_secret) |
| 312 | + self.payer.send_payment(route, payment_hash, &payment_secret, invoice.payment_metadata().cloned()) |
313 | 313 | }; |
314 | 314 | self.pay_internal(&route_params, payment_hash, send_payment) |
315 | 315 | .map_err(|e| { self.payment_cache.lock().unwrap().remove(&payment_hash); e }) |
@@ -1463,9 +1463,8 @@ mod tests { |
1463 | 1463 | Vec::new() |
1464 | 1464 | } |
1465 | 1465 |
|
1466 | | - fn send_payment( |
1467 | | - &self, route: &Route, _payment_hash: PaymentHash, |
1468 | | - _payment_secret: &Option<PaymentSecret> |
| 1466 | + fn send_payment(&self, route: &Route, _payment_hash: PaymentHash, |
| 1467 | + _payment_secret: &Option<PaymentSecret>, _payment_metadata: Option<Vec<u8>> |
1469 | 1468 | ) -> Result<PaymentId, PaymentSendFailure> { |
1470 | 1469 | self.check_value_msats(Amount::ForInvoice(route.get_total_amount())); |
1471 | 1470 | self.check_attempts() |
|
0 commit comments