@@ -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,
@@ -12563,7 +12565,7 @@ where
1256312565 Vec::with_capacity(holding_cell_htlc_update_count);
1256412566 let mut holding_cell_blinding_points: Vec<Option<PublicKey>> =
1256512567 Vec::with_capacity(holding_cell_htlc_update_count);
12566- let mut holding_cell_failure_attribution_data : Vec<Option<&AttributionData>> =
12568+ let mut holding_cell_attribution_data : Vec<Option<&AttributionData>> =
1256712569 Vec::with_capacity(holding_cell_htlc_update_count);
1256812570 // Vec of (htlc_id, failure_code, sha256_of_onion)
1256912571 let mut malformed_htlcs: Vec<(u64, u16, [u8; 32])> = Vec::new();
@@ -12589,19 +12591,25 @@ where
1258912591 holding_cell_skimmed_fees.push(skimmed_fee_msat);
1259012592 holding_cell_blinding_points.push(blinding_point);
1259112593 },
12592- &HTLCUpdateAwaitingACK::ClaimHTLC { ref payment_preimage, ref htlc_id } => {
12594+ &HTLCUpdateAwaitingACK::ClaimHTLC {
12595+ ref payment_preimage,
12596+ ref htlc_id,
12597+ ref attribution_data,
12598+ } => {
1259312599 1u8.write(writer)?;
1259412600 payment_preimage.write(writer)?;
1259512601 htlc_id.write(writer)?;
12602+
12603+ // Store the attribution data for later writing.
12604+ holding_cell_attribution_data.push(attribution_data.as_ref());
1259612605 },
1259712606 &HTLCUpdateAwaitingACK::FailHTLC { ref htlc_id, ref err_packet } => {
1259812607 2u8.write(writer)?;
1259912608 htlc_id.write(writer)?;
1260012609 err_packet.data.write(writer)?;
1260112610
1260212611 // Store the attribution data for later writing.
12603- holding_cell_failure_attribution_data
12604- .push(err_packet.attribution_data.as_ref());
12612+ holding_cell_attribution_data.push(err_packet.attribution_data.as_ref());
1260512613 },
1260612614 &HTLCUpdateAwaitingACK::FailMalformedHTLC {
1260712615 htlc_id,
@@ -12618,7 +12626,7 @@ where
1261812626
1261912627 // Push 'None' attribution data for FailMalformedHTLC, because FailMalformedHTLC uses the same
1262012628 // type 2 and is deserialized as a FailHTLC.
12621- holding_cell_failure_attribution_data .push(None);
12629+ holding_cell_attribution_data .push(None);
1262212630 },
1262312631 }
1262412632 }
@@ -12822,7 +12830,7 @@ where
1282212830 (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
1282312831 (54, self.pending_funding, optional_vec), // Added in 0.2
1282412832 (55, removed_htlc_attribution_data, optional_vec), // Added in 0.2
12825- (57, holding_cell_failure_attribution_data , optional_vec), // Added in 0.2
12833+ (57, holding_cell_attribution_data , optional_vec), // Added in 0.2
1282612834 (58, self.interactive_tx_signing_session, option), // Added in 0.2
1282712835 (59, self.funding.minimum_depth_override, option), // Added in 0.2
1282812836 (60, self.context.historical_scids, optional_vec), // Added in 0.2
@@ -12997,6 +13005,7 @@ where
1299713005 1 => HTLCUpdateAwaitingACK::ClaimHTLC {
1299813006 payment_preimage: Readable::read(reader)?,
1299913007 htlc_id: Readable::read(reader)?,
13008+ attribution_data: None,
1300013009 },
1300113010 2 => HTLCUpdateAwaitingACK::FailHTLC {
1300213011 htlc_id: Readable::read(reader)?,
@@ -13170,7 +13179,7 @@ where
1317013179 let mut holding_cell_blinding_points_opt: Option<Vec<Option<PublicKey>>> = None;
1317113180
1317213181 let mut removed_htlc_attribution_data: Option<Vec<Option<AttributionData>>> = None;
13173- let mut holding_cell_failure_attribution_data : Option<Vec<Option<AttributionData>>> = None;
13182+ let mut holding_cell_attribution_data : Option<Vec<Option<AttributionData>>> = None;
1317413183
1317513184 let mut malformed_htlcs: Option<Vec<(u64, u16, [u8; 32])>> = None;
1317613185 let mut monitor_pending_update_adds: Option<Vec<msgs::UpdateAddHTLC>> = None;
@@ -13223,7 +13232,7 @@ where
1322313232 (53, funding_tx_broadcast_safe_event_emitted, option),
1322413233 (54, pending_funding, optional_vec), // Added in 0.2
1322513234 (55, removed_htlc_attribution_data, optional_vec),
13226- (57, holding_cell_failure_attribution_data , optional_vec),
13235+ (57, holding_cell_attribution_data , optional_vec),
1322713236 (58, interactive_tx_signing_session, option), // Added in 0.2
1322813237 (59, minimum_depth_override, option), // Added in 0.2
1322913238 (60, historical_scids, optional_vec), // Added in 0.2
@@ -13357,18 +13366,17 @@ where
1335713366 }
1335813367 }
1335913368
13360- if let Some(attribution_data_list) = holding_cell_failure_attribution_data {
13369+ if let Some(attribution_data_list) = holding_cell_attribution_data {
1336113370 let mut holding_cell_failures =
13362- holding_cell_htlc_updates.iter_mut().filter_map(|upd| {
13363- if let HTLCUpdateAwaitingACK::FailHTLC {
13371+ holding_cell_htlc_updates.iter_mut().filter_map(|upd| match upd {
13372+ HTLCUpdateAwaitingACK::FailHTLC {
1336413373 err_packet: OnionErrorPacket { ref mut attribution_data, .. },
1336513374 ..
13366- } = upd
13367- {
13375+ } => Some(attribution_data),
13376+ HTLCUpdateAwaitingACK::ClaimHTLC { attribution_data, .. } => {
1336813377 Some(attribution_data)
13369- } else {
13370- None
13371- }
13378+ },
13379+ _ => None,
1337213380 });
1337313381
1337413382 for attribution_data in attribution_data_list {
@@ -14366,6 +14374,7 @@ mod tests {
1436614374 let dummy_holding_cell_claim_htlc = HTLCUpdateAwaitingACK::ClaimHTLC {
1436714375 payment_preimage: PaymentPreimage([42; 32]),
1436814376 htlc_id: 0,
14377+ attribution_data: None,
1436914378 };
1437014379 let dummy_holding_cell_failed_htlc = |htlc_id| HTLCUpdateAwaitingACK::FailHTLC {
1437114380 htlc_id,
0 commit comments