X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Finbound_payment.rs;h=731b68ce49f0d30365add7659e74792968872613;hb=89f162c168bc934f64a663f31ea12793568c55b1;hp=8ed77e5a615afe44e352d2fc5c12a0186c9bcc50;hpb=7181b53aa47b8c25aca01fda9661508d0ec7be59;p=rust-lightning diff --git a/lightning/src/ln/inbound_payment.rs b/lightning/src/ln/inbound_payment.rs index 8ed77e5a..731b68ce 100644 --- a/lightning/src/ln/inbound_payment.rs +++ b/lightning/src/ln/inbound_payment.rs @@ -14,14 +14,14 @@ use bitcoin::hashes::{Hash, HashEngine}; use bitcoin::hashes::cmp::fixed_time_eq; use bitcoin::hashes::hmac::{Hmac, HmacEngine}; use bitcoin::hashes::sha256::Hash as Sha256; -use chain::keysinterface::{KeyMaterial, KeysInterface, Sign}; -use ln::{PaymentHash, PaymentPreimage, PaymentSecret}; -use ln::msgs; -use ln::msgs::MAX_VALUE_MSAT; -use util::chacha20::ChaCha20; -use util::crypto::hkdf_extract_expand_thrice; -use util::errors::APIError; -use util::logger::Logger; +use crate::chain::keysinterface::{KeyMaterial, KeysInterface}; +use crate::ln::{PaymentHash, PaymentPreimage, PaymentSecret}; +use crate::ln::msgs; +use crate::ln::msgs::MAX_VALUE_MSAT; +use crate::util::chacha20::ChaCha20; +use crate::util::crypto::hkdf_extract_expand_thrice; +use crate::util::errors::APIError; +use crate::util::logger::Logger; use core::convert::TryInto; use core::ops::Deref; @@ -91,8 +91,8 @@ impl Method { /// `current_time` is a Unix timestamp representing the current time. /// /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager -pub fn create(keys: &ExpandedKey, min_value_msat: Option, invoice_expiry_delta_secs: u32, keys_manager: &K, current_time: u64) -> Result<(PaymentHash, PaymentSecret), ()> - where K::Target: KeysInterface +pub fn create(keys: &ExpandedKey, min_value_msat: Option, invoice_expiry_delta_secs: u32, keys_manager: &K, current_time: u64) -> Result<(PaymentHash, PaymentSecret), ()> + where K::Target: KeysInterface { let metadata_bytes = construct_metadata_bytes(min_value_msat, Method::LdkPaymentHash, invoice_expiry_delta_secs, current_time)?; @@ -200,7 +200,7 @@ fn construct_payment_secret(iv_bytes: &[u8; IV_LEN], metadata_bytes: &[u8; METAD /// [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material /// [`create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment /// [`create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash -pub(super) fn verify(payment_hash: PaymentHash, payment_data: msgs::FinalOnionHopData, highest_seen_timestamp: u64, keys: &ExpandedKey, logger: &L) -> Result, ()> +pub(super) fn verify(payment_hash: PaymentHash, payment_data: &msgs::FinalOnionHopData, highest_seen_timestamp: u64, keys: &ExpandedKey, logger: &L) -> Result, ()> where L::Target: Logger { let (iv_bytes, metadata_bytes) = decrypt_metadata(payment_data.payment_secret, keys);