let dust_limit_satoshis = if local { self.our_dust_limit_satoshis } else { self.their_dust_limit_satoshis };
let mut remote_htlc_total_msat = 0;
let dust_limit_satoshis = if local { self.our_dust_limit_satoshis } else { self.their_dust_limit_satoshis };
let mut remote_htlc_total_msat = 0;
- let mut outputs: Vec<TxOut> = Vec::new();
- let mut htlcs_used: Vec<HTLCOutputInCommitment> = Vec::new();
+ let mut outputs: Vec<TxOut> = Vec::with_capacity(txouts.len());
+ let mut htlcs_used: Vec<HTLCOutputInCommitment> = Vec::with_capacity(txouts.len());
for (idx, out) in txouts.drain(..).enumerate() {
outputs.push(out.0);
if let Some(out_htlc) = out.1 {
for (idx, out) in txouts.drain(..).enumerate() {
outputs.push(out.0);
if let Some(out_htlc) = out.1 {
self.channel_state = ChannelState::FundingSent as u32;
let funding_txo = self.channel_monitor.get_funding_txo().unwrap();
self.channel_id = funding_txo.0.into_be() ^ Uint256::from_u64(funding_txo.1 as u64).unwrap(); //TODO: or le?
self.channel_state = ChannelState::FundingSent as u32;
let funding_txo = self.channel_monitor.get_funding_txo().unwrap();
self.channel_id = funding_txo.0.into_be() ^ Uint256::from_u64(funding_txo.1 as u64).unwrap(); //TODO: or le?
let temporary_channel_id = self.channel_id;
// Now that we're past error-generating stuff, update our local state:
let temporary_channel_id = self.channel_id;
// Now that we're past error-generating stuff, update our local state:
self.channel_state = ChannelState::FundingCreated as u32;
let funding_txo = self.channel_monitor.get_funding_txo().unwrap();
self.channel_id = funding_txo.0.into_be() ^ Uint256::from_u64(funding_txo.1 as u64).unwrap(); //TODO: or le?
self.channel_state = ChannelState::FundingCreated as u32;
let funding_txo = self.channel_monitor.get_funding_txo().unwrap();
self.channel_id = funding_txo.0.into_be() ^ Uint256::from_u64(funding_txo.1 as u64).unwrap(); //TODO: or le?