projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2939 from TheBlueMatt/2024-03-no-wake-on-shutdown-121
[rust-lightning]
/
lightning-invoice
/
src
/
payment.rs
diff --git
a/lightning-invoice/src/payment.rs
b/lightning-invoice/src/payment.rs
index a7c9104d3697e774c03c03ef3cee3d7eadc0989c..152b9d348322c009498bf1fae10a8c2854c376fc 100644
(file)
--- a/
lightning-invoice/src/payment.rs
+++ b/
lightning-invoice/src/payment.rs
@@
-10,11
+10,10
@@
//! Convenient utilities for paying Lightning invoices.
use crate::Bolt11Invoice;
//! Convenient utilities for paying Lightning invoices.
use crate::Bolt11Invoice;
-
-use bitcoin_hashes::Hash;
+use bitcoin::hashes::Hash;
use lightning::ln::PaymentHash;
use lightning::ln::PaymentHash;
-use lightning::ln::
channelmanager
::RecipientOnionFields;
+use lightning::ln::
outbound_payment
::RecipientOnionFields;
use lightning::routing::router::{PaymentParameters, RouteParameters};
/// Builds the necessary parameters to pay or pre-flight probe the given zero-amount
use lightning::routing::router::{PaymentParameters, RouteParameters};
/// Builds the necessary parameters to pay or pre-flight probe the given zero-amount
@@
-60,7
+59,7
@@
pub fn payment_parameters_from_invoice(invoice: &Bolt11Invoice)
fn params_from_invoice(invoice: &Bolt11Invoice, amount_msat: u64)
-> (PaymentHash, RecipientOnionFields, RouteParameters) {
fn params_from_invoice(invoice: &Bolt11Invoice, amount_msat: u64)
-> (PaymentHash, RecipientOnionFields, RouteParameters) {
- let payment_hash = PaymentHash((*invoice.payment_hash()).
into_inner
());
+ let payment_hash = PaymentHash((*invoice.payment_hash()).
to_byte_array
());
let mut recipient_onion = RecipientOnionFields::secret_only(*invoice.payment_secret());
recipient_onion.payment_metadata = invoice.payment_metadata().map(|v| v.clone());
let mut recipient_onion = RecipientOnionFields::secret_only(*invoice.payment_secret());
recipient_onion.payment_metadata = invoice.payment_metadata().map(|v| v.clone());
@@
-85,15
+84,13
@@
fn params_from_invoice(invoice: &Bolt11Invoice, amount_msat: u64)
mod tests {
use super::*;
use crate::{InvoiceBuilder, Currency};
mod tests {
use super::*;
use crate::{InvoiceBuilder, Currency};
- use bitcoin_hashes::sha256::Hash as Sha256;
- use lightning::events::Event;
- use lightning::ln::channelmanager::{Retry, PaymentId};
- use lightning::ln::msgs::ChannelMessageHandler;
+ use bitcoin::hashes::sha256::Hash as Sha256;
use lightning::ln::PaymentSecret;
use lightning::ln::PaymentSecret;
- use lightning::ln::functional_test_utils::*;
use lightning::routing::router::Payee;
use secp256k1::{SecretKey, PublicKey, Secp256k1};
use lightning::routing::router::Payee;
use secp256k1::{SecretKey, PublicKey, Secp256k1};
- use std::time::{SystemTime, Duration};
+ use core::time::Duration;
+ #[cfg(feature = "std")]
+ use std::time::SystemTime;
fn duration_since_epoch() -> Duration {
#[cfg(feature = "std")]
fn duration_since_epoch() -> Duration {
#[cfg(feature = "std")]
@@
-172,6
+169,11
@@
mod tests {
#[test]
#[cfg(feature = "std")]
fn payment_metadata_end_to_end() {
#[test]
#[cfg(feature = "std")]
fn payment_metadata_end_to_end() {
+ use lightning::events::Event;
+ use lightning::ln::channelmanager::PaymentId;
+ use lightning::ln::outbound_payment::Retry;
+ use lightning::ln::msgs::ChannelMessageHandler;
+ use lightning::ln::functional_test_utils::*;
// Test that a payment metadata read from an invoice passed to `pay_invoice` makes it all
// the way out through the `PaymentClaimable` event.
let chanmon_cfgs = create_chanmon_cfgs(2);
// Test that a payment metadata read from an invoice passed to `pay_invoice` makes it all
// the way out through the `PaymentClaimable` event.
let chanmon_cfgs = create_chanmon_cfgs(2);