+ let htlcs_count: u64 = Readable::read(reader)?;
+ let mut per_htlc = HashMap::with_capacity(cmp::min(htlcs_count as usize, MAX_ALLOC_SIZE / 32));
+ for _ in 0..htlcs_count {
+ let htlc: HTLCOutputInCommitment = Readable::read(reader)?;
+ let sigs = match <u8 as Readable>::read(reader)? {
+ 0 => None,
+ 1 => Some(Readable::read(reader)?),
+ _ => return Err(DecodeError::InvalidValue),
+ };
+ per_htlc.insert(htlc.transaction_output_index.unwrap(), (htlc, sigs));
+ }