@@ -467,6 +467,7 @@ enum HTLCUpdateAwaitingACK {
467467 },
468468 ClaimHTLC {
469469 payment_preimage: PaymentPreimage,
470+ attribution_data: Option<AttributionData>,
470471 htlc_id: u64,
471472 },
472473 FailHTLC {
@@ -6314,6 +6315,7 @@ where
63146315 self.context.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::ClaimHTLC {
63156316 payment_preimage: payment_preimage_arg,
63166317 htlc_id: htlc_id_arg,
6318+ attribution_data: None,
63176319 });
63186320 return UpdateFulfillFetch::NewClaim {
63196321 monitor_update,
@@ -12579,7 +12581,7 @@ where
1257912581 Vec::with_capacity(holding_cell_htlc_update_count);
1258012582 let mut holding_cell_blinding_points: Vec<Option<PublicKey>> =
1258112583 Vec::with_capacity(holding_cell_htlc_update_count);
12582- let mut holding_cell_failure_attribution_data : Vec<Option<&AttributionData>> =
12584+ let mut holding_cell_attribution_data : Vec<Option<&AttributionData>> =
1258312585 Vec::with_capacity(holding_cell_htlc_update_count);
1258412586 // Vec of (htlc_id, failure_code, sha256_of_onion)
1258512587 let mut malformed_htlcs: Vec<(u64, u16, [u8; 32])> = Vec::new();
@@ -12605,19 +12607,25 @@ where
1260512607 holding_cell_skimmed_fees.push(skimmed_fee_msat);
1260612608 holding_cell_blinding_points.push(blinding_point);
1260712609 },
12608- &HTLCUpdateAwaitingACK::ClaimHTLC { ref payment_preimage, ref htlc_id } => {
12610+ &HTLCUpdateAwaitingACK::ClaimHTLC {
12611+ ref payment_preimage,
12612+ ref htlc_id,
12613+ ref attribution_data,
12614+ } => {
1260912615 1u8.write(writer)?;
1261012616 payment_preimage.write(writer)?;
1261112617 htlc_id.write(writer)?;
12618+
12619+ // Store the attribution data for later writing.
12620+ holding_cell_attribution_data.push(attribution_data.as_ref());
1261212621 },
1261312622 &HTLCUpdateAwaitingACK::FailHTLC { ref htlc_id, ref err_packet } => {
1261412623 2u8.write(writer)?;
1261512624 htlc_id.write(writer)?;
1261612625 err_packet.data.write(writer)?;
1261712626
1261812627 // Store the attribution data for later writing.
12619- holding_cell_failure_attribution_data
12620- .push(err_packet.attribution_data.as_ref());
12628+ holding_cell_attribution_data.push(err_packet.attribution_data.as_ref());
1262112629 },
1262212630 &HTLCUpdateAwaitingACK::FailMalformedHTLC {
1262312631 htlc_id,
@@ -12634,7 +12642,7 @@ where
1263412642
1263512643 // Push 'None' attribution data for FailMalformedHTLC, because FailMalformedHTLC uses the same
1263612644 // type 2 and is deserialized as a FailHTLC.
12637- holding_cell_failure_attribution_data .push(None);
12645+ holding_cell_attribution_data .push(None);
1263812646 },
1263912647 }
1264012648 }
@@ -12838,7 +12846,7 @@ where
1283812846 (53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
1283912847 (54, self.pending_funding, optional_vec), // Added in 0.2
1284012848 (55, removed_htlc_attribution_data, optional_vec), // Added in 0.2
12841- (57, holding_cell_failure_attribution_data , optional_vec), // Added in 0.2
12849+ (57, holding_cell_attribution_data , optional_vec), // Added in 0.2
1284212850 (58, self.interactive_tx_signing_session, option), // Added in 0.2
1284312851 (59, self.funding.minimum_depth_override, option), // Added in 0.2
1284412852 (60, self.context.historical_scids, optional_vec), // Added in 0.2
@@ -13012,6 +13020,7 @@ where
1301213020 1 => HTLCUpdateAwaitingACK::ClaimHTLC {
1301313021 payment_preimage: Readable::read(reader)?,
1301413022 htlc_id: Readable::read(reader)?,
13023+ attribution_data: None,
1301513024 },
1301613025 2 => HTLCUpdateAwaitingACK::FailHTLC {
1301713026 htlc_id: Readable::read(reader)?,
@@ -13184,7 +13193,7 @@ where
1318413193 let mut holding_cell_blinding_points_opt: Option<Vec<Option<PublicKey>>> = None;
1318513194
1318613195 let mut removed_htlc_attribution_data: Option<Vec<Option<AttributionData>>> = None;
13187- let mut holding_cell_failure_attribution_data : Option<Vec<Option<AttributionData>>> = None;
13196+ let mut holding_cell_attribution_data : Option<Vec<Option<AttributionData>>> = None;
1318813197
1318913198 let mut malformed_htlcs: Option<Vec<(u64, u16, [u8; 32])>> = None;
1319013199 let mut monitor_pending_update_adds: Option<Vec<msgs::UpdateAddHTLC>> = None;
@@ -13237,7 +13246,7 @@ where
1323713246 (53, funding_tx_broadcast_safe_event_emitted, option),
1323813247 (54, pending_funding, optional_vec), // Added in 0.2
1323913248 (55, removed_htlc_attribution_data, optional_vec),
13240- (57, holding_cell_failure_attribution_data , optional_vec),
13249+ (57, holding_cell_attribution_data , optional_vec),
1324113250 (58, interactive_tx_signing_session, option), // Added in 0.2
1324213251 (59, minimum_depth_override, option), // Added in 0.2
1324313252 (60, historical_scids, optional_vec), // Added in 0.2
@@ -13367,18 +13376,17 @@ where
1336713376 }
1336813377 }
1336913378
13370- if let Some(attribution_data_list) = holding_cell_failure_attribution_data {
13379+ if let Some(attribution_data_list) = holding_cell_attribution_data {
1337113380 let mut holding_cell_failures =
13372- holding_cell_htlc_updates.iter_mut().filter_map(|upd| {
13373- if let HTLCUpdateAwaitingACK::FailHTLC {
13381+ holding_cell_htlc_updates.iter_mut().filter_map(|upd| match upd {
13382+ HTLCUpdateAwaitingACK::FailHTLC {
1337413383 err_packet: OnionErrorPacket { ref mut attribution_data, .. },
1337513384 ..
13376- } = upd
13377- {
13385+ } => Some(attribution_data),
13386+ HTLCUpdateAwaitingACK::ClaimHTLC { attribution_data, .. } => {
1337813387 Some(attribution_data)
13379- } else {
13380- None
13381- }
13388+ },
13389+ _ => None,
1338213390 });
1338313391
1338413392 for attribution_data in attribution_data_list {
@@ -14379,6 +14387,7 @@ mod tests {
1437914387 let dummy_holding_cell_claim_htlc = HTLCUpdateAwaitingACK::ClaimHTLC {
1438014388 payment_preimage: PaymentPreimage([42; 32]),
1438114389 htlc_id: 0,
14390+ attribution_data: None,
1438214391 };
1438314392 let dummy_holding_cell_failed_htlc = |htlc_id| HTLCUpdateAwaitingACK::FailHTLC {
1438414393 htlc_id,
0 commit comments