ins
};
- let mut txouts: Vec<(TxOut, Option<(HTLCOutputInCommitment, Option<&HTLCSource>)>, Script)> = Vec::with_capacity(self.pending_inbound_htlcs.len() + self.pending_outbound_htlcs.len() + 2);
+ let mut txouts: Vec<(TxOut, (Option<(HTLCOutputInCommitment, Option<&HTLCSource>)>, Script))> =
+ Vec::with_capacity(self.pending_inbound_htlcs.len() + self.pending_outbound_htlcs.len() + 2);
let mut included_dust_htlcs: Vec<(HTLCOutputInCommitment, Option<&HTLCSource>)> = Vec::new();
let dust_limit_satoshis = if local { self.our_dust_limit_satoshis } else { self.their_dust_limit_satoshis };
txouts.push((TxOut {
script_pubkey: script.to_v0_p2wsh(),
value: $htlc.amount_msat / 1000
- }, Some((htlc_in_tx, $source)), script));
+ }, (Some((htlc_in_tx, $source)), script)));
} else {
log_trace!(self, " ...including {} {} dust HTLC {} (hash {}) with value {} due to dust limit", if $outbound { "outbound" } else { "inbound" }, $state_name, $htlc.htlc_id, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
included_dust_htlcs.push((htlc_in_tx, $source));
txouts.push((TxOut { // "received HTLC output"
script_pubkey: script.to_v0_p2wsh(),
value: $htlc.amount_msat / 1000
- }, Some((htlc_in_tx, $source)), script));
+ }, (Some((htlc_in_tx, $source)), script)));
} else {
log_trace!(self, " ...including {} {} dust HTLC {} (hash {}) with value {}", if $outbound { "outbound" } else { "inbound" }, $state_name, $htlc.htlc_id, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
included_dust_htlcs.push((htlc_in_tx, $source));
txouts.push((TxOut {
script_pubkey: script.to_v0_p2wsh(),
value: value_to_a as u64
- }, None, script));
+ }, (None, script)));
}
if value_to_b >= (dust_limit_satoshis as i64) {
txouts.push((TxOut {
script_pubkey: script,
value: value_to_b as u64
- }, None, redeem_script));
+ }, (None, redeem_script)));
}
- transaction_utils::sort_outputs2(&mut txouts, |a, b| {
+ transaction_utils::sort_outputs(&mut txouts, |(a, _), (b, _)| {
if let &Some(ref a_htlc) = a {
if let &Some(ref b_htlc) = b {
a_htlc.0.cltv_expiry.cmp(&b_htlc.0.cltv_expiry)
let mut outputs: Vec<TxOut> = Vec::with_capacity(txouts.len());
let mut scripts: Vec<Script> = Vec::with_capacity(txouts.len());
let mut htlcs_included: Vec<(HTLCOutputInCommitment, Option<&HTLCSource>)> = Vec::with_capacity(txouts.len() + included_dust_htlcs.len());
- for (idx, mut out) in txouts.drain(..).enumerate() {
- outputs.push(out.0);
- scripts.push(out.2);
- if let Some((mut htlc, source_option)) = out.1.take() {
+ for (idx, (out, (mut htlc_data, script))) in txouts.drain(..).enumerate() {
+ outputs.push(out);
+ scripts.push(script);
+ if let Some((mut htlc, source_option)) = htlc_data.take() {
htlc.transaction_output_index = Some(idx as u32);
htlcs_included.push((htlc, source_option));
}