let feerate = fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::Normal);
Ok(Channel {
- user_id: user_id,
+ user_id,
config: config.channel_options.clone(),
channel_id: keys_provider.get_secure_random_bytes(),
channel_state: ChannelState::OurInitSent as u32,
channel_outbound: true,
secp_ctx: Secp256k1::new(),
- channel_value_satoshis: channel_value_satoshis,
+ channel_value_satoshis,
latest_monitor_update_id: 0,
} else { None };
let chan = Channel {
- user_id: user_id,
+ user_id,
config: local_config,
channel_id: msg.temporary_channel_id,
feerate_per_kw: msg.feerate_per_kw,
channel_value_satoshis: msg.funding_satoshis,
counterparty_dust_limit_satoshis: msg.dust_limit_satoshis,
- holder_dust_limit_satoshis: holder_dust_limit_satoshis,
+ holder_dust_limit_satoshis,
counterparty_max_htlc_value_in_flight_msat: cmp::min(msg.max_htlc_value_in_flight_msat, msg.funding_satoshis * 1000),
counterparty_selected_channel_reserve_satoshis: msg.channel_reserve_satoshis,
counterparty_htlc_minimum_msat: msg.htlc_minimum_msat,
Ok((msgs::FundingSigned {
channel_id: self.channel_id,
- signature: signature
+ signature
}, channel_monitor))
}
Ok((msgs::RevokeAndACK {
channel_id: self.channel_id,
- per_commitment_secret: per_commitment_secret,
- next_per_commitment_point: next_per_commitment_point,
+ per_commitment_secret,
+ next_per_commitment_point,
}, commitment_signed, closing_signed, monitor_update))
}
update_fulfill_htlcs,
update_fail_htlcs,
update_fail_malformed_htlcs: Vec::new(),
- update_fee: update_fee,
+ update_fee,
commitment_signed,
}, monitor_update)), htlcs_to_fail))
} else {
Some(msgs::UpdateFee {
channel_id: self.channel_id,
- feerate_per_kw: feerate_per_kw,
+ feerate_per_kw,
})
}
let next_per_commitment_point = self.holder_keys.get_per_commitment_point(self.cur_holder_commitment_transaction_number, &self.secp_ctx);
Some(msgs::FundingLocked {
channel_id: self.channel_id(),
- next_per_commitment_point: next_per_commitment_point,
+ next_per_commitment_point,
})
} else { None };
let next_per_commitment_point = self.holder_keys.get_per_commitment_point(self.cur_holder_commitment_transaction_number, &self.secp_ctx);
return Ok((Some(msgs::FundingLocked {
channel_id: self.channel_id(),
- next_per_commitment_point: next_per_commitment_point,
+ next_per_commitment_point,
}), None, None, None, RAACommitmentOrder::CommitmentFirst, shutdown_msg));
}
let next_per_commitment_point = self.holder_keys.get_per_commitment_point(self.cur_holder_commitment_transaction_number, &self.secp_ctx);
Some(msgs::FundingLocked {
channel_id: self.channel_id(),
- next_per_commitment_point: next_per_commitment_point,
+ next_per_commitment_point,
})
} else { None };
let next_per_commitment_point = self.holder_keys.get_per_commitment_point(self.cur_holder_commitment_transaction_number, &self.secp_ctx);
return Ok((Some(msgs::FundingLocked {
channel_id: self.channel_id,
- next_per_commitment_point: next_per_commitment_point,
+ next_per_commitment_point,
}), timed_out_htlcs));
} else {
self.monitor_pending_funding_locked = true;
let keys = self.holder_keys.pubkeys();
msgs::OpenChannel {
- chain_hash: chain_hash,
+ chain_hash,
temporary_channel_id: self.channel_id,
funding_satoshis: self.channel_value_satoshis,
push_msat: self.channel_value_satoshis * 1000 - self.value_to_self_msat,
temporary_channel_id,
funding_txid: funding_txo.txid,
funding_output_index: funding_txo.index,
- signature: signature
+ signature
})
}
let msg = msgs::UnsignedChannelAnnouncement {
features: ChannelFeatures::known(),
- chain_hash: chain_hash,
+ chain_hash,
short_channel_id: self.get_short_channel_id().unwrap(),
node_id_1: if were_node_one { node_id } else { self.get_counterparty_node_id() },
node_id_2: if were_node_one { self.get_counterparty_node_id() } else { node_id },
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,
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,
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(_) => {
}
} 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,
});
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(())
};
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(())