@@ -404,7 +404,7 @@ impl OutboundHTLCState {
404
404
enum OutboundHTLCOutcome {
405
405
/// We started always filling in the preimages here in 0.0.105, and the requirement
406
406
/// 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>),
408
408
Failure(HTLCFailReason),
409
409
}
410
410
@@ -1184,7 +1184,7 @@ pub(super) struct MonitorRestoreUpdates {
1184
1184
pub order: RAACommitmentOrder,
1185
1185
pub accepted_htlcs: Vec<(PendingHTLCInfo, u64)>,
1186
1186
pub failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
1187
- pub finalized_claimed_htlcs: Vec<HTLCSource>,
1187
+ pub finalized_claimed_htlcs: Vec<( HTLCSource, Option<AttributionData>) >,
1188
1188
pub pending_update_adds: Vec<msgs::UpdateAddHTLC>,
1189
1189
pub funding_broadcastable: Option<Transaction>,
1190
1190
pub channel_ready: Option<msgs::ChannelReady>,
@@ -2314,7 +2314,7 @@ where
2314
2314
// but need to handle this somehow or we run the risk of losing HTLCs!
2315
2315
monitor_pending_forwards: Vec<(PendingHTLCInfo, u64)>,
2316
2316
monitor_pending_failures: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
2317
- monitor_pending_finalized_fulfills: Vec<HTLCSource>,
2317
+ monitor_pending_finalized_fulfills: Vec<( HTLCSource, Option<AttributionData>) >,
2318
2318
monitor_pending_update_adds: Vec<msgs::UpdateAddHTLC>,
2319
2319
monitor_pending_tx_signatures: Option<msgs::TxSignatures>,
2320
2320
@@ -6695,7 +6695,8 @@ where
6695
6695
));
6696
6696
}
6697
6697
6698
- let outcome = OutboundHTLCOutcome::Success(msg.payment_preimage, None);
6698
+ let outcome =
6699
+ OutboundHTLCOutcome::Success(msg.payment_preimage, msg.attribution_data.clone());
6699
6700
self.mark_outbound_htlc_removed(msg.htlc_id, outcome).map(|htlc| {
6700
6701
(htlc.source.clone(), htlc.amount_msat, htlc.skimmed_fee_msat, htlc.send_timestamp)
6701
6702
})
@@ -7516,16 +7517,21 @@ where
7516
7517
&htlc.payment_hash
7517
7518
);
7518
7519
// We really want take() here, but, again, non-mut ref :(
7519
- if let OutboundHTLCOutcome::Failure(mut reason) = outcome.clone() {
7520
- hold_time(htlc.send_timestamp, now).map(|hold_time| {
7521
- reason.set_hold_time(hold_time);
7522
- });
7523
-
7524
- revoked_htlcs.push((htlc.source.clone(), htlc.payment_hash, reason));
7525
- } else {
7526
- finalized_claimed_htlcs.push(htlc.source.clone());
7527
- // They fulfilled, so we sent them money
7528
- value_to_self_msat_diff -= htlc.amount_msat as i64;
7520
+ match outcome.clone() {
7521
+ OutboundHTLCOutcome::Failure(mut reason) => {
7522
+ hold_time(htlc.send_timestamp, now).map(|hold_time| {
7523
+ reason.set_hold_time(hold_time);
7524
+ });
7525
+ revoked_htlcs.push((htlc.source.clone(), htlc.payment_hash, reason));
7526
+ },
7527
+ OutboundHTLCOutcome::Success(_, attribution_data) => {
7528
+ // Even though a fast track was taken for fulfilled HTLCs to the incoming side, we still
7529
+ // pass along attribution data here so that we can include hold time information in the
7530
+ // final PaymentPathSuccessful events.
7531
+ finalized_claimed_htlcs.push((htlc.source.clone(), attribution_data));
7532
+ // They fulfilled, so we sent them money
7533
+ value_to_self_msat_diff -= htlc.amount_msat as i64;
7534
+ },
7529
7535
}
7530
7536
false
7531
7537
} else {
@@ -8008,7 +8014,7 @@ where
8008
8014
&mut self, resend_raa: bool, resend_commitment: bool, resend_channel_ready: bool,
8009
8015
mut pending_forwards: Vec<(PendingHTLCInfo, u64)>,
8010
8016
mut pending_fails: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
8011
- mut pending_finalized_claimed_htlcs: Vec<HTLCSource>,
8017
+ mut pending_finalized_claimed_htlcs: Vec<( HTLCSource, Option<AttributionData>) >,
8012
8018
) {
8013
8019
self.context.monitor_pending_revoke_and_ack |= resend_raa;
8014
8020
self.context.monitor_pending_commitment_signed |= resend_commitment;
0 commit comments