@@ -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
@@ -6677,7 +6677,8 @@ where
6677
6677
));
6678
6678
}
6679
6679
6680
- let outcome = OutboundHTLCOutcome::Success(msg.payment_preimage, None);
6680
+ let outcome =
6681
+ OutboundHTLCOutcome::Success(msg.payment_preimage, msg.attribution_data.clone());
6681
6682
self.mark_outbound_htlc_removed(msg.htlc_id, outcome).map(|htlc| {
6682
6683
(htlc.source.clone(), htlc.amount_msat, htlc.skimmed_fee_msat, htlc.send_timestamp)
6683
6684
})
@@ -7498,16 +7499,21 @@ where
7498
7499
&htlc.payment_hash
7499
7500
);
7500
7501
// 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
+ },
7511
7517
}
7512
7518
false
7513
7519
} else {
@@ -7990,7 +7996,7 @@ where
7990
7996
&mut self, resend_raa: bool, resend_commitment: bool, resend_channel_ready: bool,
7991
7997
mut pending_forwards: Vec<(PendingHTLCInfo, u64)>,
7992
7998
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>) >,
7994
8000
) {
7995
8001
self.context.monitor_pending_revoke_and_ack |= resend_raa;
7996
8002
self.context.monitor_pending_commitment_signed |= resend_commitment;
0 commit comments