@@ -404,7 +404,7 @@ impl OutboundHTLCState {
404404enum OutboundHTLCOutcome {
405405 /// We started always filling in the preimages here in 0.0.105, and the requirement
406406 /// that the preimages always be filled in was added in 0.2.
407- Success(PaymentPreimage, #[allow(dead_code)] Option<AttributionData>),
407+ Success(PaymentPreimage, Option<AttributionData>),
408408 Failure(HTLCFailReason),
409409}
410410
@@ -1184,7 +1184,7 @@ pub(super) struct MonitorRestoreUpdates {
11841184 pub order: RAACommitmentOrder,
11851185 pub accepted_htlcs: Vec<(PendingHTLCInfo, u64)>,
11861186 pub failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
1187- pub finalized_claimed_htlcs: Vec<HTLCSource>,
1187+ pub finalized_claimed_htlcs: Vec<( HTLCSource, Option<AttributionData>) >,
11881188 pub pending_update_adds: Vec<msgs::UpdateAddHTLC>,
11891189 pub funding_broadcastable: Option<Transaction>,
11901190 pub channel_ready: Option<msgs::ChannelReady>,
@@ -2314,7 +2314,7 @@ where
23142314 // but need to handle this somehow or we run the risk of losing HTLCs!
23152315 monitor_pending_forwards: Vec<(PendingHTLCInfo, u64)>,
23162316 monitor_pending_failures: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
2317- monitor_pending_finalized_fulfills: Vec<HTLCSource>,
2317+ monitor_pending_finalized_fulfills: Vec<( HTLCSource, Option<AttributionData>) >,
23182318 monitor_pending_update_adds: Vec<msgs::UpdateAddHTLC>,
23192319 monitor_pending_tx_signatures: Option<msgs::TxSignatures>,
23202320
@@ -6677,7 +6677,8 @@ where
66776677 ));
66786678 }
66796679
6680- let outcome = OutboundHTLCOutcome::Success(msg.payment_preimage, None);
6680+ let outcome =
6681+ OutboundHTLCOutcome::Success(msg.payment_preimage, msg.attribution_data.clone());
66816682 self.mark_outbound_htlc_removed(msg.htlc_id, outcome).map(|htlc| {
66826683 (htlc.source.clone(), htlc.amount_msat, htlc.skimmed_fee_msat, htlc.send_timestamp)
66836684 })
@@ -7498,16 +7499,21 @@ where
74987499 &htlc.payment_hash
74997500 );
75007501 // We really want take() here, but, again, non-mut ref :(
7501- if let OutboundHTLCOutcome::Failure(mut reason) = outcome.clone() {
7502- hold_time(htlc.send_timestamp, now).map(|hold_time| {
7503- reason.set_hold_time(hold_time);
7504- });
7505-
7506- revoked_htlcs.push((htlc.source.clone(), htlc.payment_hash, reason));
7507- } else {
7508- finalized_claimed_htlcs.push(htlc.source.clone());
7509- // They fulfilled, so we sent them money
7510- value_to_self_msat_diff -= htlc.amount_msat as i64;
7502+ match outcome.clone() {
7503+ OutboundHTLCOutcome::Failure(mut reason) => {
7504+ hold_time(htlc.send_timestamp, now).map(|hold_time| {
7505+ reason.set_hold_time(hold_time);
7506+ });
7507+ revoked_htlcs.push((htlc.source.clone(), htlc.payment_hash, reason));
7508+ },
7509+ OutboundHTLCOutcome::Success(_, attribution_data) => {
7510+ // Even though a fast track was taken for fulfilled HTLCs to the incoming side, we still
7511+ // pass along attribution data here so that we can include hold time information in the
7512+ // final PaymentPathSuccessful events.
7513+ finalized_claimed_htlcs.push((htlc.source.clone(), attribution_data));
7514+ // They fulfilled, so we sent them money
7515+ value_to_self_msat_diff -= htlc.amount_msat as i64;
7516+ },
75117517 }
75127518 false
75137519 } else {
@@ -7990,7 +7996,7 @@ where
79907996 &mut self, resend_raa: bool, resend_commitment: bool, resend_channel_ready: bool,
79917997 mut pending_forwards: Vec<(PendingHTLCInfo, u64)>,
79927998 mut pending_fails: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
7993- mut pending_finalized_claimed_htlcs: Vec<HTLCSource>,
7999+ mut pending_finalized_claimed_htlcs: Vec<( HTLCSource, Option<AttributionData>) >,
79948000 ) {
79958001 self.context.monitor_pending_revoke_and_ack |= resend_raa;
79968002 self.context.monitor_pending_commitment_signed |= resend_commitment;
0 commit comments