@@ -428,6 +428,7 @@ struct OutboundHTLCOutput {
428428 skimmed_fee_msat: Option<u64>,
429429 send_timestamp: Option<Duration>,
430430 hold_htlc: Option<()>,
431+ accountable: Option<u8>,
431432}
432433
433434/// See AwaitingRemoteRevoke ChannelState for more info
@@ -9641,7 +9642,7 @@ where
96419642 skimmed_fee_msat: htlc.skimmed_fee_msat,
96429643 blinding_point: htlc.blinding_point,
96439644 hold_htlc: htlc.hold_htlc,
9644- accountable: None ,
9645+ accountable: htlc.accountable ,
96459646 });
96469647 }
96479648 }
@@ -12586,6 +12587,7 @@ where
1258612587 skimmed_fee_msat,
1258712588 send_timestamp,
1258812589 hold_htlc: hold_htlc.then(|| ()),
12590+ accountable,
1258912591 });
1259012592 self.context.next_holder_htlc_id += 1;
1259112593
@@ -14434,6 +14436,7 @@ where
1443414436 let mut pending_outbound_skimmed_fees: Vec<Option<u64>> = Vec::new();
1443514437 let mut pending_outbound_blinding_points: Vec<Option<PublicKey>> = Vec::new();
1443614438 let mut pending_outbound_held_htlc_flags: Vec<Option<()>> = Vec::new();
14439+ let mut pending_outbound_accountable: Vec<Option<u8>> = Vec::new();
1443714440
1443814441 (self.context.pending_outbound_htlcs.len() as u64).write(writer)?;
1443914442 for htlc in self.context.pending_outbound_htlcs.iter() {
@@ -14477,6 +14480,7 @@ where
1447714480 pending_outbound_skimmed_fees.push(htlc.skimmed_fee_msat);
1447814481 pending_outbound_blinding_points.push(htlc.blinding_point);
1447914482 pending_outbound_held_htlc_flags.push(htlc.hold_htlc);
14483+ pending_outbound_accountable.push(htlc.accountable);
1448014484 }
1448114485
1448214486 let holding_cell_htlc_update_count = self.context.holding_cell_htlc_updates.len();
@@ -14772,6 +14776,7 @@ where
1477214776 (67, pending_outbound_held_htlc_flags, optional_vec), // Added in 0.2
1477314777 (69, holding_cell_held_htlc_flags, optional_vec), // Added in 0.2
1477414778 (71, holding_cell_accountable_flags, optional_vec), // Added in 0.3
14779+ (73, pending_outbound_accountable, optional_vec), // Added in 0.3
1477514780 });
1477614781
1477714782 Ok(())
@@ -14921,6 +14926,7 @@ where
1492114926 blinding_point: None,
1492214927 send_timestamp: None,
1492314928 hold_htlc: None,
14929+ accountable: None,
1492414930 });
1492514931 }
1492614932
@@ -15140,6 +15146,7 @@ where
1514015146
1514115147 let mut pending_outbound_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1514215148 let mut holding_cell_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
15149+ let mut pending_outbound_accountable_opt: Option<Vec<Option<u8>>> = None;
1514315150 let mut holding_cell_accountable_opt: Option<Vec<Option<u8>>> = None;
1514415151
1514515152 read_tlv_fields!(reader, {
@@ -15189,6 +15196,7 @@ where
1518915196 (67, pending_outbound_held_htlc_flags_opt, optional_vec), // Added in 0.2
1519015197 (69, holding_cell_held_htlc_flags_opt, optional_vec), // Added in 0.2
1519115198 (71, holding_cell_accountable_opt, optional_vec), // Added in 0.3
15199+ (73, pending_outbound_accountable_opt, optional_vec), // Added in 0.3
1519215200 });
1519315201
1519415202 let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -15325,7 +15333,16 @@ where
1532515333 return Err(DecodeError::InvalidValue);
1532615334 }
1532715335 }
15328-
15336+ if let Some(held_htlcs) = pending_outbound_accountable_opt {
15337+ let mut iter = held_htlcs.into_iter();
15338+ for htlc in pending_outbound_htlcs.iter_mut() {
15339+ htlc.accountable = iter.next().ok_or(DecodeError::InvalidValue)?;
15340+ }
15341+ // We expect all accountable HTLC signals to be consumed above
15342+ if iter.next().is_some() {
15343+ return Err(DecodeError::InvalidValue);
15344+ }
15345+ }
1532915346 if let Some(attribution_data_list) = removed_htlc_attribution_data {
1533015347 let mut removed_htlcs = pending_inbound_htlcs.iter_mut().filter_map(|status| {
1533115348 if let InboundHTLCState::LocalRemoved(reason) = &mut status.state {
@@ -15907,6 +15924,7 @@ mod tests {
1590715924 blinding_point: None,
1590815925 send_timestamp: None,
1590915926 hold_htlc: None,
15927+ accountable: None,
1591015928 });
1591115929
1591215930 // Make sure when Node A calculates their local commitment transaction, none of the HTLCs pass
@@ -16362,6 +16380,7 @@ mod tests {
1636216380 blinding_point: None,
1636316381 send_timestamp: None,
1636416382 hold_htlc: None,
16383+ accountable: None,
1636516384 };
1636616385 let mut pending_outbound_htlcs = vec![dummy_outbound_output.clone(); 10];
1636716386 for (idx, htlc) in pending_outbound_htlcs.iter_mut().enumerate() {
0 commit comments