X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannelmanager.rs;h=b43c98c840392c7b983de276e0867ba5e3baf795;hb=82f5a1cbdacd341a54bbf98f2835c0f8f6d8787a;hp=6b2f50e9704b0a16312eb9f10134dcee0f9b6882;hpb=a162840ffd228f201ad281f715ef63c459eda14c;p=rust-lightning diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 6b2f50e9..b43c98c8 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -16,6 +16,7 @@ //! It does not manage routing logic (see routing::router::get_route for that) nor does it manage constructing //! on-chain transactions (it only monitors the chain to watch for any force-closes that might //! imply it needs to fail HTLCs/payments/channels it manages). +//! use bitcoin::blockdata::block::BlockHeader; use bitcoin::blockdata::constants::genesis_block; @@ -404,9 +405,9 @@ pub struct ChannelManager, secp_ctx: Secp256k1, - #[cfg(test)] + #[cfg(any(test, feature = "_test_utils"))] pub(super) channel_state: Mutex>, - #[cfg(not(test))] + #[cfg(not(any(test, feature = "_test_utils")))] channel_state: Mutex>, our_network_key: SecretKey, @@ -1126,7 +1127,7 @@ impl PendingHTLCStatus::Forward(PendingHTLCInfo { routing: PendingHTLCRouting::Forward { onion_packet: outgoing_packet, - short_channel_id: short_channel_id, + short_channel_id, }, payment_hash: msg.payment_hash.clone(), incoming_shared_secret: shared_secret, @@ -1221,7 +1222,7 @@ impl let unsigned = msgs::UnsignedChannelUpdate { chain_hash: self.genesis_hash, - short_channel_id: short_channel_id, + short_channel_id, timestamp: chan.get_update_time_counter(), flags: (!were_node_one) as u8 | ((!chan.is_live() as u8) << 1), cltv_expiry_delta: CLTV_EXPIRY_DELTA, @@ -1447,7 +1448,7 @@ impl let mut channel_state = self.channel_state.lock().unwrap(); channel_state.pending_msg_events.push(events::MessageSendEvent::SendFundingCreated { node_id: chan.get_counterparty_node_id(), - msg: msg, + msg, }); match channel_state.by_id.entry(chan.channel_id()) { hash_map::Entry::Occupied(_) => { @@ -1745,14 +1746,14 @@ impl } } else if total_value == data.total_msat { new_events.push(events::Event::PaymentReceived { - payment_hash: payment_hash, + payment_hash, payment_secret: Some(data.payment_secret), amt: total_value, }); } } else { new_events.push(events::Event::PaymentReceived { - payment_hash: payment_hash, + payment_hash, payment_secret: None, amt: amt_to_forward, }); @@ -2304,7 +2305,7 @@ impl pending_events.push(events::Event::FundingGenerationReady { temporary_channel_id: msg.temporary_channel_id, channel_value_satoshis: value, - output_script: output_script, + output_script, user_channel_id: user_id, }); Ok(()) @@ -2384,7 +2385,7 @@ impl }; let mut pending_events = self.pending_events.lock().unwrap(); pending_events.push(events::Event::FundingBroadcastSafe { - funding_txo: funding_txo, + funding_txo, user_channel_id: user_id, }); Ok(())