X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fonion_utils.rs;h=07686a214e23c90c3e1166bca19580da55309777;hb=8e7b5905fd84999318bdcf9cbcb9cfecbf58f532;hp=08e9e6a88cecb6f30bd6824a41da493b243f72b7;hpb=50df4cf464261fbc6d808892cd43b7599c2274eb;p=rust-lightning diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index 08e9e6a8..07686a21 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -1,4 +1,14 @@ -use ln::channelmanager::{PaymentHash, PaymentSecret, HTLCSource}; +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + +use ln::{PaymentHash, PaymentSecret}; +use ln::channelmanager::HTLCSource; use ln::msgs; use routing::router::RouteHop; use util::byte_utils; @@ -18,7 +28,7 @@ use bitcoin::secp256k1::ecdh::SharedSecret; use bitcoin::secp256k1; use std::io::Cursor; -use std::ops::Deref; +use core::ops::Deref; pub(super) struct OnionKeys { #[cfg(test)] @@ -297,8 +307,8 @@ pub(super) fn build_failure_packet(shared_secret: &[u8], failure_type: u16, fail }; let mut packet = msgs::DecodedOnionErrorPacket { hmac: [0; 32], - failuremsg: failuremsg, - pad: pad, + failuremsg, + pad, }; let mut hmac = HmacEngine::::new(&um); @@ -440,10 +450,10 @@ pub(super) fn process_onion_failure(secp_ctx: & let (description, title) = errors::get_onion_error_description(error_code); if debug_field_size > 0 && err_packet.failuremsg.len() >= 4 + debug_field_size { - log_warn!(logger, "Onion Error[{}({:#x}) {}({})] {}", title, error_code, debug_field, log_bytes!(&err_packet.failuremsg[4..4+debug_field_size]), description); + log_warn!(logger, "Onion Error[from {}: {}({:#x}) {}({})] {}", route_hop.pubkey, title, error_code, debug_field, log_bytes!(&err_packet.failuremsg[4..4+debug_field_size]), description); } else { - log_warn!(logger, "Onion Error[{}({:#x})] {}", title, error_code, description); + log_warn!(logger, "Onion Error[from {}: {}({:#x})] {}", route_hop.pubkey, title, error_code, description); } } else { // Useless packet that we can't use but it passed HMAC, so it @@ -468,7 +478,7 @@ pub(super) fn process_onion_failure(secp_ctx: & #[cfg(test)] mod tests { - use ln::channelmanager::PaymentHash; + use ln::PaymentHash; use ln::features::{ChannelFeatures, NodeFeatures}; use routing::router::{Route, RouteHop}; use ln::msgs;