X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fonion_utils.rs;h=36a6ccabc070bdca0e9b68a09ce236e60569cc62;hb=87126b391b895098484a86dc484a381b825e9a31;hp=dc3b2f9022542556e9cc01bba9aa0d757fc85fe8;hpb=0d755456328d68151cdb66a1d8280912de7eb50c;p=rust-lightning diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index dc3b2f90..36a6ccab 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -1,24 +1,24 @@ use ln::channelmanager::{PaymentHash, PaymentSecret, HTLCSource}; use ln::msgs; -use ln::router::RouteHop; +use routing::router::RouteHop; use util::byte_utils; use util::chacha20::ChaCha20; use util::errors::{self, APIError}; use util::ser::{Readable, Writeable, LengthCalculatingWriter}; -use util::logger::{Logger, LogHolder}; +use util::logger::Logger; -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 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 secp256k1::key::{SecretKey,PublicKey}; -use secp256k1::Secp256k1; -use secp256k1::ecdh::SharedSecret; -use secp256k1; +use bitcoin::secp256k1::key::{SecretKey,PublicKey}; +use bitcoin::secp256k1::Secp256k1; +use bitcoin::secp256k1::ecdh::SharedSecret; +use bitcoin::secp256k1; use std::io::Cursor; -use std::sync::Arc; +use std::ops::Deref; pub(super) struct OnionKeys { #[cfg(test)] @@ -318,7 +318,7 @@ pub(super) fn build_first_hop_failure_packet(shared_secret: &[u8], failure_type: /// OutboundRoute). /// Returns update, a boolean indicating that the payment itself failed, and the error code. #[inline] -pub(super) fn process_onion_failure(secp_ctx: &Secp256k1, logger: &Arc, htlc_source: &HTLCSource, mut packet_decrypted: Vec) -> (Option, bool, Option, Option>) { +pub(super) fn process_onion_failure(secp_ctx: &Secp256k1, logger: &L, htlc_source: &HTLCSource, mut packet_decrypted: Vec) -> (Option, bool, Option, Option>) where L::Target: Logger { if let &HTLCSource::OutboundRoute { ref path, ref session_priv, ref first_hop_htlc_msat } = htlc_source { let mut res = None; let mut htlc_msat = *first_hop_htlc_msat; @@ -440,12 +440,10 @@ pub(super) fn process_onion_failure(secp_ctx: &Secp256k1< let (description, title) = errors::get_onion_error_description(error_code); if debug_field_size > 0 && err_packet.failuremsg.len() >= 4 + debug_field_size { - let log_holder = LogHolder { logger }; - log_warn!(log_holder, "Onion Error[{}({:#x}) {}({})] {}", title, error_code, debug_field, log_bytes!(&err_packet.failuremsg[4..4+debug_field_size]), description); + log_warn!(logger, "Onion Error[{}({:#x}) {}({})] {}", title, error_code, debug_field, log_bytes!(&err_packet.failuremsg[4..4+debug_field_size]), description); } else { - let log_holder = LogHolder { logger }; - log_warn!(log_holder, "Onion Error[{}({:#x})] {}", title, error_code, description); + log_warn!(logger, "Onion Error[{}({:#x})] {}", title, error_code, description); } } else { // Useless packet that we can't use but it passed HMAC, so it @@ -472,14 +470,14 @@ pub(super) fn process_onion_failure(secp_ctx: &Secp256k1< mod tests { use ln::channelmanager::PaymentHash; use ln::features::{ChannelFeatures, NodeFeatures}; - use ln::router::{Route, RouteHop}; + use routing::router::{Route, RouteHop}; use ln::msgs; use util::ser::{Writeable, Writer}; use hex; - use secp256k1::Secp256k1; - use secp256k1::key::{PublicKey,SecretKey}; + use bitcoin::secp256k1::Secp256k1; + use bitcoin::secp256k1::key::{PublicKey,SecretKey}; use super::OnionKeys;