X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fonion_utils.rs;h=4886168dd16cc277adfd536fcedbca83ba03ac1a;hb=e06484b0f44155e647ff29810d2f187967e45813;hp=0deb8b74fdcfc1542cb56f044dd387b83af72c7a;hpb=1d4f9c8dec54a276834fb563d4b82e852ba931f6;p=rust-lightning diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index 0deb8b74..4886168d 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -7,7 +7,7 @@ // You may not use this file except in accordance with one or both of these // licenses. -use ln::{PaymentHash, PaymentSecret}; +use ln::{PaymentHash, PaymentPreimage, PaymentSecret}; use ln::channelmanager::HTLCSource; use ln::msgs; use routing::router::RouteHop; @@ -27,7 +27,7 @@ use bitcoin::secp256k1::ecdh::SharedSecret; use bitcoin::secp256k1; use prelude::*; -use std::io::Cursor; +use io::Cursor; use core::convert::TryInto; use core::ops::Deref; @@ -119,7 +119,7 @@ pub(super) fn construct_onion_keys(secp_ctx: &Secp256k1, total_msat: u64, payment_secret_option: &Option, starting_htlc_offset: u32) -> Result<(Vec, u64, u32), APIError> { +pub(super) fn build_onion_payloads(path: &Vec, total_msat: u64, payment_secret_option: &Option, starting_htlc_offset: u32, keysend_preimage: &Option) -> Result<(Vec, u64, u32), APIError> { let mut cur_value_msat = 0u64; let mut cur_cltv = starting_htlc_offset; let mut last_short_channel_id = 0; @@ -141,6 +141,7 @@ pub(super) fn build_onion_payloads(path: &Vec, total_msat: u64, paymen total_msat, }) } else { None }, + keysend_preimage: *keysend_preimage, } } else { msgs::OnionHopDataFormat::NonFinalNode { @@ -479,6 +480,7 @@ pub(super) fn process_onion_failure(secp_ctx: & #[cfg(test)] mod tests { + use io; use prelude::*; use ln::PaymentHash; use ln::features::{ChannelFeatures, NodeFeatures}; @@ -647,7 +649,7 @@ mod tests { } } impl Writeable for RawOnionHopData { - fn write(&self, writer: &mut W) -> Result<(), ::std::io::Error> { + fn write(&self, writer: &mut W) -> Result<(), io::Error> { writer.write_all(&self.data[..]) } }