@@ -466,6 +466,7 @@ enum HTLCUpdateAwaitingACK {
466466 },
467467 ClaimHTLC {
468468 payment_preimage: PaymentPreimage,
469+ attribution_data: Option<AttributionData>,
469470 htlc_id: u64,
470471 },
471472 FailHTLC {
@@ -6339,6 +6340,7 @@ where
63396340 self.context.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::ClaimHTLC {
63406341 payment_preimage: payment_preimage_arg,
63416342 htlc_id: htlc_id_arg,
6343+ attribution_data: None,
63426344 });
63436345 return UpdateFulfillFetch::NewClaim {
63446346 monitor_update,
@@ -12560,7 +12562,7 @@ where
1256012562 Vec::with_capacity(holding_cell_htlc_update_count);
1256112563 let mut holding_cell_blinding_points: Vec<Option<PublicKey>> =
1256212564 Vec::with_capacity(holding_cell_htlc_update_count);
12563- let mut holding_cell_failure_attribution_data : Vec<Option<&AttributionData>> =
12565+ let mut holding_cell_attribution_data : Vec<Option<&AttributionData>> =
1256412566 Vec::with_capacity(holding_cell_htlc_update_count);
1256512567 // Vec of (htlc_id, failure_code, sha256_of_onion)
1256612568 let mut malformed_htlcs: Vec<(u64, u16, [u8; 32])> = Vec::new();
@@ -12586,19 +12588,25 @@ where
1258612588 holding_cell_skimmed_fees.push(skimmed_fee_msat);
1258712589 holding_cell_blinding_points.push(blinding_point);
1258812590 },
12589- &HTLCUpdateAwaitingACK::ClaimHTLC { ref payment_preimage, ref htlc_id } => {
12591+ &HTLCUpdateAwaitingACK::ClaimHTLC {
12592+ ref payment_preimage,
12593+ ref htlc_id,
12594+ ref attribution_data,
12595+ } => {
1259012596 1u8.write(writer)?;
1259112597 payment_preimage.write(writer)?;
1259212598 htlc_id.write(writer)?;
12599+
12600+ // Store the attribution data for later writing.
12601+ holding_cell_attribution_data.push(attribution_data.as_ref());
1259312602 },
1259412603 &HTLCUpdateAwaitingACK::FailHTLC { ref htlc_id, ref err_packet } => {
1259512604 2u8.write(writer)?;
1259612605 htlc_id.write(writer)?;
1259712606 err_packet.data.write(writer)?;
1259812607
1259912608 // Store the attribution data for later writing.
12600- holding_cell_failure_attribution_data
12601- .push(err_packet.attribution_data.as_ref());
12609+ holding_cell_attribution_data.push(err_packet.attribution_data.as_ref());
1260212610 },
1260312611 &HTLCUpdateAwaitingACK::FailMalformedHTLC {
1260412612 htlc_id,
@@ -12615,7 +12623,7 @@ where
1261512623
1261612624 // Push 'None' attribution data for FailMalformedHTLC, because FailMalformedHTLC uses the same
1261712625 // type 2 and is deserialized as a FailHTLC.
12618- holding_cell_failure_attribution_data .push(None);
12626+ holding_cell_attribution_data .push(None);
1261912627 },
1262012628 }
1262112629 }
@@ -12819,7 +12827,7 @@ where
1281912827 (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
1282012828 (54, self.pending_funding, optional_vec), // Added in 0.2
1282112829 (55, removed_htlc_attribution_data, optional_vec), // Added in 0.2
12822- (57, holding_cell_failure_attribution_data , optional_vec), // Added in 0.2
12830+ (57, holding_cell_attribution_data , optional_vec), // Added in 0.2
1282312831 (58, self.interactive_tx_signing_session, option), // Added in 0.2
1282412832 (59, self.funding.minimum_depth_override, option), // Added in 0.2
1282512833 (60, self.context.historical_scids, optional_vec), // Added in 0.2
@@ -12993,6 +13001,7 @@ where
1299313001 1 => HTLCUpdateAwaitingACK::ClaimHTLC {
1299413002 payment_preimage: Readable::read(reader)?,
1299513003 htlc_id: Readable::read(reader)?,
13004+ attribution_data: None,
1299613005 },
1299713006 2 => HTLCUpdateAwaitingACK::FailHTLC {
1299813007 htlc_id: Readable::read(reader)?,
@@ -13165,7 +13174,7 @@ where
1316513174 let mut holding_cell_blinding_points_opt: Option<Vec<Option<PublicKey>>> = None;
1316613175
1316713176 let mut removed_htlc_attribution_data: Option<Vec<Option<AttributionData>>> = None;
13168- let mut holding_cell_failure_attribution_data : Option<Vec<Option<AttributionData>>> = None;
13177+ let mut holding_cell_attribution_data : Option<Vec<Option<AttributionData>>> = None;
1316913178
1317013179 let mut malformed_htlcs: Option<Vec<(u64, u16, [u8; 32])>> = None;
1317113180 let mut monitor_pending_update_adds: Option<Vec<msgs::UpdateAddHTLC>> = None;
@@ -13218,7 +13227,7 @@ where
1321813227 (53, funding_tx_broadcast_safe_event_emitted, option),
1321913228 (54, pending_funding, optional_vec), // Added in 0.2
1322013229 (55, removed_htlc_attribution_data, optional_vec),
13221- (57, holding_cell_failure_attribution_data , optional_vec),
13230+ (57, holding_cell_attribution_data , optional_vec),
1322213231 (58, interactive_tx_signing_session, option), // Added in 0.2
1322313232 (59, minimum_depth_override, option), // Added in 0.2
1322413233 (60, historical_scids, optional_vec), // Added in 0.2
@@ -13350,18 +13359,17 @@ where
1335013359 }
1335113360 }
1335213361
13353- if let Some(attribution_data_list) = holding_cell_failure_attribution_data {
13362+ if let Some(attribution_data_list) = holding_cell_attribution_data {
1335413363 let mut holding_cell_failures =
13355- holding_cell_htlc_updates.iter_mut().filter_map(|upd| {
13356- if let HTLCUpdateAwaitingACK::FailHTLC {
13364+ holding_cell_htlc_updates.iter_mut().filter_map(|upd| match upd {
13365+ HTLCUpdateAwaitingACK::FailHTLC {
1335713366 err_packet: OnionErrorPacket { ref mut attribution_data, .. },
1335813367 ..
13359- } = upd
13360- {
13368+ } => Some(attribution_data),
13369+ HTLCUpdateAwaitingACK::ClaimHTLC { attribution_data, .. } => {
1336113370 Some(attribution_data)
13362- } else {
13363- None
13364- }
13371+ },
13372+ _ => None,
1336513373 });
1336613374
1336713375 for attribution_data in attribution_data_list {
@@ -14359,6 +14367,7 @@ mod tests {
1435914367 let dummy_holding_cell_claim_htlc = HTLCUpdateAwaitingACK::ClaimHTLC {
1436014368 payment_preimage: PaymentPreimage([42; 32]),
1436114369 htlc_id: 0,
14370+ attribution_data: None,
1436214371 };
1436314372 let dummy_holding_cell_failed_htlc = |htlc_id| HTLCUpdateAwaitingACK::FailHTLC {
1436414373 htlc_id,
0 commit comments