Skip to content

Commit c738213

Browse files
Add attribution_data field to data structures
This commit does not yet introduce attribution data, but just adds the field and required serialization logic to the relevant types. Co-authored-by: Matt Corallo <[email protected]>
1 parent ea93270 commit c738213

File tree

9 files changed

+127
-24
lines changed

9 files changed

+127
-24
lines changed

lightning/src/ln/channel.rs

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use crate::ln::chan_utils::{
5050
#[cfg(splicing)]
5151
use crate::ln::chan_utils::FUNDING_TRANSACTION_WITNESS_WEIGHT;
5252
use crate::ln::chan_utils;
53-
use crate::ln::onion_utils::{HTLCFailReason};
53+
use crate::ln::onion_utils::{HTLCFailReason, ATTRIBUTION_DATA_LEN};
5454
use crate::chain::BestBlock;
5555
use crate::chain::chaininterface::{FeeEstimator, ConfirmationTarget, LowerBoundedFeeEstimator, fee_for_weight};
5656
use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, LATENCY_GRACE_PERIOD_BLOCKS};
@@ -4929,7 +4929,7 @@ trait FailHTLCContents {
49294929
impl FailHTLCContents for msgs::OnionErrorPacket {
49304930
type Message = msgs::UpdateFailHTLC;
49314931
fn to_message(self, htlc_id: u64, channel_id: ChannelId) -> Self::Message {
4932-
msgs::UpdateFailHTLC { htlc_id, channel_id, reason: self.data }
4932+
msgs::UpdateFailHTLC { htlc_id, channel_id, reason: self.data, attribution_data: self.attribution_data }
49334933
}
49344934
fn to_inbound_htlc_state(self) -> InboundHTLCState {
49354935
InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(self))
@@ -6840,6 +6840,7 @@ impl<SP: Deref> FundedChannel<SP> where
68406840
channel_id: self.context.channel_id(),
68416841
htlc_id: htlc.htlc_id,
68426842
reason: err_packet.data.clone(),
6843+
attribution_data: err_packet.attribution_data,
68436844
});
68446845
},
68456846
&InboundHTLCRemovalReason::FailMalformed((ref sha256_of_onion, ref failure_code)) => {
@@ -10242,6 +10243,7 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1024210243
dropped_inbound_htlcs += 1;
1024310244
}
1024410245
}
10246+
let mut removed_htlc_failure_attribution_data: Vec<&Option<[u8; ATTRIBUTION_DATA_LEN]>> = Vec::new();
1024510247
(self.context.pending_inbound_htlcs.len() as u64 - dropped_inbound_htlcs).write(writer)?;
1024610248
for htlc in self.context.pending_inbound_htlcs.iter() {
1024710249
if let &InboundHTLCState::RemoteAnnounced(_) = &htlc.state {
@@ -10267,9 +10269,10 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1026710269
&InboundHTLCState::LocalRemoved(ref removal_reason) => {
1026810270
4u8.write(writer)?;
1026910271
match removal_reason {
10270-
InboundHTLCRemovalReason::FailRelay(msgs::OnionErrorPacket { data }) => {
10272+
InboundHTLCRemovalReason::FailRelay(msgs::OnionErrorPacket { data, attribution_data }) => {
1027110273
0u8.write(writer)?;
1027210274
data.write(writer)?;
10275+
removed_htlc_failure_attribution_data.push(&attribution_data);
1027310276
},
1027410277
InboundHTLCRemovalReason::FailMalformed((hash, code)) => {
1027510278
1u8.write(writer)?;
@@ -10331,10 +10334,11 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1033110334

1033210335
let mut holding_cell_skimmed_fees: Vec<Option<u64>> = Vec::new();
1033310336
let mut holding_cell_blinding_points: Vec<Option<PublicKey>> = Vec::new();
10337+
let mut holding_cell_failure_attribution_data: Vec<(u32, [u8; ATTRIBUTION_DATA_LEN])> = Vec::new();
1033410338
// Vec of (htlc_id, failure_code, sha256_of_onion)
1033510339
let mut malformed_htlcs: Vec<(u64, u16, [u8; 32])> = Vec::new();
1033610340
(self.context.holding_cell_htlc_updates.len() as u64).write(writer)?;
10337-
for update in self.context.holding_cell_htlc_updates.iter() {
10341+
for (i, update) in self.context.holding_cell_htlc_updates.iter().enumerate() {
1033810342
match update {
1033910343
&HTLCUpdateAwaitingACK::AddHTLC {
1034010344
ref amount_msat, ref cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet,
@@ -10359,6 +10363,13 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1035910363
2u8.write(writer)?;
1036010364
htlc_id.write(writer)?;
1036110365
err_packet.data.write(writer)?;
10366+
10367+
// Store the attribution data for later writing. Include the holding cell htlc update index because
10368+
// FailMalformedHTLC is stored with the same type 2 and we wouldn't be able to distinguish the two
10369+
// when reading back in.
10370+
if let Some(attribution_data ) = err_packet.attribution_data {
10371+
holding_cell_failure_attribution_data.push((i as u32, attribution_data));
10372+
}
1036210373
}
1036310374
&HTLCUpdateAwaitingACK::FailMalformedHTLC {
1036410375
htlc_id, failure_code, sha256_of_onion
@@ -10542,6 +10553,8 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
1054210553
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
1054310554
(51, is_manual_broadcast, option), // Added in 0.0.124
1054410555
(53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
10556+
(55, removed_htlc_failure_attribution_data, optional_vec), // Added in 0.2
10557+
(57, holding_cell_failure_attribution_data, optional_vec), // Added in 0.2
1054510558
});
1054610559

1054710560
Ok(())
@@ -10619,6 +10632,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1061910632
let reason = match <u8 as Readable>::read(reader)? {
1062010633
0 => InboundHTLCRemovalReason::FailRelay(msgs::OnionErrorPacket {
1062110634
data: Readable::read(reader)?,
10635+
attribution_data: None,
1062210636
}),
1062310637
1 => InboundHTLCRemovalReason::FailMalformed(Readable::read(reader)?),
1062410638
2 => InboundHTLCRemovalReason::Fulfill(Readable::read(reader)?),
@@ -10683,6 +10697,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1068310697
htlc_id: Readable::read(reader)?,
1068410698
err_packet: OnionErrorPacket {
1068510699
data: Readable::read(reader)?,
10700+
attribution_data: None,
1068610701
},
1068710702
},
1068810703
_ => return Err(DecodeError::InvalidValue),
@@ -10826,6 +10841,9 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1082610841
let mut pending_outbound_blinding_points_opt: Option<Vec<Option<PublicKey>>> = None;
1082710842
let mut holding_cell_blinding_points_opt: Option<Vec<Option<PublicKey>>> = None;
1082810843

10844+
let mut removed_htlc_failure_attribution_data: Option<Vec<Option<[u8; ATTRIBUTION_DATA_LEN]>>> = None;
10845+
let mut holding_cell_failure_attribution_data: Option<Vec<(u32, [u8; ATTRIBUTION_DATA_LEN])>> = None;
10846+
1082910847
let mut malformed_htlcs: Option<Vec<(u64, u16, [u8; 32])>> = None;
1083010848
let mut monitor_pending_update_adds: Option<Vec<msgs::UpdateAddHTLC>> = None;
1083110849

@@ -10868,6 +10886,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1086810886
(49, local_initiated_shutdown, option),
1086910887
(51, is_manual_broadcast, option),
1087010888
(53, funding_tx_broadcast_safe_event_emitted, option),
10889+
(55, removed_htlc_failure_attribution_data, optional_vec),
10890+
(57, holding_cell_failure_attribution_data, optional_vec),
1087110891
});
1087210892

1087310893
let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -10949,6 +10969,38 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c Channel
1094910969
if iter.next().is_some() { return Err(DecodeError::InvalidValue) }
1095010970
}
1095110971

10972+
if let Some(attribution_data_list) = removed_htlc_failure_attribution_data {
10973+
let mut removed_htlc_relay_failures =
10974+
pending_inbound_htlcs.iter_mut().filter_map(|status|
10975+
if let InboundHTLCState::LocalRemoved(ref mut reason) = &mut status.state {
10976+
if let InboundHTLCRemovalReason::FailRelay(ref mut packet) = reason {
10977+
Some(&mut packet.attribution_data)
10978+
} else {
10979+
None
10980+
}
10981+
} else {
10982+
None
10983+
}
10984+
);
10985+
10986+
for attribution_data in attribution_data_list {
10987+
*removed_htlc_relay_failures.next().ok_or(DecodeError::InvalidValue)? = attribution_data;
10988+
}
10989+
if removed_htlc_relay_failures.next().is_some() { return Err(DecodeError::InvalidValue); }
10990+
}
10991+
10992+
if let Some(attribution_data_list) = holding_cell_failure_attribution_data {
10993+
for (i, attribution_data) in attribution_data_list {
10994+
let update = holding_cell_htlc_updates.get_mut(i as usize).ok_or(DecodeError::InvalidValue)?;
10995+
10996+
if let HTLCUpdateAwaitingACK::FailHTLC { htlc_id: _, ref mut err_packet } = update {
10997+
err_packet.attribution_data = Some(attribution_data);
10998+
} else {
10999+
return Err(DecodeError::InvalidValue);
11000+
}
11001+
}
11002+
}
11003+
1095211004
if let Some(malformed_htlcs) = malformed_htlcs {
1095311005
for (malformed_htlc_id, failure_code, sha256_of_onion) in malformed_htlcs {
1095411006
let htlc_idx = holding_cell_htlc_updates.iter().position(|htlc| {
@@ -11152,7 +11204,7 @@ mod tests {
1115211204
use bitcoin::network::Network;
1115311205
#[cfg(splicing)]
1115411206
use bitcoin::Weight;
11155-
use crate::ln::onion_utils::INVALID_ONION_BLINDING;
11207+
use crate::ln::onion_utils::{ATTRIBUTION_DATA_LEN, INVALID_ONION_BLINDING};
1115611208
use crate::types::payment::{PaymentHash, PaymentPreimage};
1115711209
use crate::ln::channel_keys::{RevocationKey, RevocationBasepoint};
1115811210
use crate::ln::channelmanager::{self, HTLCSource, PaymentId};
@@ -11789,7 +11841,7 @@ mod tests {
1178911841
htlc_id: 0,
1179011842
};
1179111843
let dummy_holding_cell_failed_htlc = |htlc_id| HTLCUpdateAwaitingACK::FailHTLC {
11792-
htlc_id, err_packet: msgs::OnionErrorPacket { data: vec![42] }
11844+
htlc_id, err_packet: msgs::OnionErrorPacket { data: vec![42], attribution_data: Some([1; ATTRIBUTION_DATA_LEN]) }
1179311845
};
1179411846
let dummy_holding_cell_malformed_htlc = |htlc_id| HTLCUpdateAwaitingACK::FailMalformedHTLC {
1179511847
htlc_id, failure_code: INVALID_ONION_BLINDING, sha256_of_onion: [0; 32],

lightning/src/ln/channelmanager.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use crate::types::features::Bolt11InvoiceFeatures;
5959
use crate::routing::router::{BlindedTail, InFlightHtlcs, Path, Payee, PaymentParameters, RouteParameters, RouteParametersConfig, Router, FixedRouter, Route};
6060
use crate::ln::onion_payment::{check_incoming_htlc_cltv, create_recv_pending_htlc_info, create_fwd_pending_htlc_info, decode_incoming_update_add_htlc_onion, HopConnector, InboundHTLCErr, NextPacketDetails};
6161
use crate::ln::msgs;
62-
use crate::ln::onion_utils;
62+
use crate::ln::onion_utils::{self};
6363
use crate::ln::onion_utils::{HTLCFailReason, INVALID_ONION_BLINDING};
6464
use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, CommitmentUpdate, DecodeError, LightningError, MessageSendEvent};
6565
#[cfg(test)]
@@ -4476,6 +4476,7 @@ where
44764476
channel_id: msg.channel_id,
44774477
htlc_id: msg.htlc_id,
44784478
reason: failure.data,
4479+
attribution_data: failure.attribution_data,
44794480
})
44804481
}
44814482

@@ -4505,6 +4506,7 @@ where
45054506
channel_id: msg.channel_id,
45064507
htlc_id: msg.htlc_id,
45074508
reason: failure.data,
4509+
attribution_data: failure.attribution_data,
45084510
}));
45094511
}
45104512
}
@@ -12968,11 +12970,15 @@ impl_writeable_tlv_based!(PendingHTLCInfo, {
1296812970
impl Writeable for HTLCFailureMsg {
1296912971
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
1297012972
match self {
12971-
HTLCFailureMsg::Relay(msgs::UpdateFailHTLC { channel_id, htlc_id, reason }) => {
12973+
HTLCFailureMsg::Relay(msgs::UpdateFailHTLC { channel_id, htlc_id, reason, attribution_data }) => {
1297212974
0u8.write(writer)?;
1297312975
channel_id.write(writer)?;
1297412976
htlc_id.write(writer)?;
1297512977
reason.write(writer)?;
12978+
12979+
// This code will only ever be hit for legacy data that is re-serialized. It isn't necessary to try
12980+
// writing out attribution data, because it can never be present.
12981+
debug_assert!(attribution_data.is_none());
1297612982
},
1297712983
HTLCFailureMsg::Malformed(msgs::UpdateFailMalformedHTLC {
1297812984
channel_id, htlc_id, sha256_of_onion, failure_code
@@ -12997,6 +13003,7 @@ impl Readable for HTLCFailureMsg {
1299713003
channel_id: Readable::read(reader)?,
1299813004
htlc_id: Readable::read(reader)?,
1299913005
reason: Readable::read(reader)?,
13006+
attribution_data: None,
1300013007
}))
1300113008
},
1300213009
1 => {
@@ -13227,6 +13234,7 @@ impl Writeable for HTLCForwardInfo {
1322713234
write_tlv_fields!(w, {
1322813235
(0, htlc_id, required),
1322913236
(2, err_packet.data, required),
13237+
(5, err_packet.attribution_data, option),
1323013238
});
1323113239
},
1323213240
Self::FailMalformedHTLC { htlc_id, failure_code, sha256_of_onion } => {
@@ -13257,8 +13265,12 @@ impl Readable for HTLCForwardInfo {
1325713265
(1, malformed_htlc_failure_code, option),
1325813266
(2, err_packet, required),
1325913267
(3, sha256_of_onion, option),
13268+
(5, attribution_data, option),
1326013269
});
1326113270
if let Some(failure_code) = malformed_htlc_failure_code {
13271+
if attribution_data.is_some() {
13272+
return Err(DecodeError::InvalidValue);
13273+
}
1326213274
Self::FailMalformedHTLC {
1326313275
htlc_id: _init_tlv_based_struct_field!(htlc_id, required),
1326413276
failure_code,
@@ -13269,6 +13281,7 @@ impl Readable for HTLCForwardInfo {
1326913281
htlc_id: _init_tlv_based_struct_field!(htlc_id, required),
1327013282
err_packet: crate::ln::msgs::OnionErrorPacket {
1327113283
data: _init_tlv_based_struct_field!(err_packet, required),
13284+
attribution_data: _init_tlv_based_struct_field!(attribution_data, option),
1327213285
},
1327313286
}
1327413287
}
@@ -14954,6 +14967,7 @@ mod tests {
1495414967
use bitcoin::secp256k1::ecdh::SharedSecret;
1495514968
use core::sync::atomic::Ordering;
1495614969
use crate::events::{Event, HTLCDestination, ClosureReason};
14970+
use crate::ln::onion_utils::ATTRIBUTION_DATA_LEN;
1495714971
use crate::ln::types::ChannelId;
1495814972
use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret};
1495914973
use crate::ln::channelmanager::{create_recv_pending_htlc_info, inbound_payment, ChannelConfigOverrides, HTLCForwardInfo, InterceptId, PaymentId, RecipientOnionFields};
@@ -16276,7 +16290,7 @@ mod tests {
1627616290
let mut nodes = create_network(1, &node_cfg, &chanmgrs);
1627716291

1627816292
let dummy_failed_htlc = |htlc_id| {
16279-
HTLCForwardInfo::FailHTLC { htlc_id, err_packet: msgs::OnionErrorPacket { data: vec![42] } }
16293+
HTLCForwardInfo::FailHTLC { htlc_id, err_packet: msgs::OnionErrorPacket { data: vec![42], attribution_data: Some([0; ATTRIBUTION_DATA_LEN]) } }
1628016294
};
1628116295
let dummy_malformed_htlc = |htlc_id| {
1628216296
HTLCForwardInfo::FailMalformedHTLC { htlc_id, failure_code: 0x4000, sha256_of_onion: [0; 32] }

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7060,6 +7060,7 @@ pub fn test_update_fulfill_htlc_bolt2_update_fail_htlc_before_commitment() {
70607060
channel_id: chan.2,
70617061
htlc_id: 0,
70627062
reason: Vec::new(),
7063+
attribution_data: None,
70637064
};
70647065

70657066
nodes[0].node.handle_update_fail_htlc(nodes[1].node.get_our_node_id(), &update_msg);

lightning/src/ln/msgs.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,10 @@ pub struct UpdateFailHTLC {
767767
/// The HTLC ID
768768
pub htlc_id: u64,
769769
pub(crate) reason: Vec<u8>,
770-
}
771770

771+
/// Optional field for the attribution data that allows the sender to pinpoint the failing node under all conditions
772+
pub attribution_data: Option<[u8; ATTRIBUTION_DATA_LEN]>
773+
}
772774
/// An [`update_fail_malformed_htlc`] message to be sent to or received from a peer.
773775
///
774776
/// [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
@@ -2247,6 +2249,8 @@ pub use self::fuzzy_internal_msgs::*;
22472249
#[cfg(not(fuzzing))]
22482250
pub(crate) use self::fuzzy_internal_msgs::*;
22492251

2252+
use super::onion_utils::ATTRIBUTION_DATA_LEN;
2253+
22502254
/// BOLT 4 onion packet including hop data for the next peer.
22512255
#[derive(Clone, Hash, PartialEq, Eq)]
22522256
pub struct OnionPacket {
@@ -2354,12 +2358,14 @@ pub(crate) struct OnionErrorPacket {
23542358
// This really should be a constant size slice, but the spec lets these things be up to 128KB?
23552359
// (TODO) We limit it in decode to much lower...
23562360
pub(crate) data: Vec<u8>,
2361+
pub(crate) attribution_data: Option<[u8; ATTRIBUTION_DATA_LEN]>,
23572362
}
23582363

23592364
impl From<UpdateFailHTLC> for OnionErrorPacket {
23602365
fn from(msg: UpdateFailHTLC) -> Self {
23612366
OnionErrorPacket {
23622367
data: msg.reason,
2368+
attribution_data: msg.attribution_data,
23632369
}
23642370
}
23652371
}
@@ -2982,7 +2988,10 @@ impl_writeable_msg!(UpdateFailHTLC, {
29822988
channel_id,
29832989
htlc_id,
29842990
reason
2985-
}, {});
2991+
}, {
2992+
// Specified TLV key 1 plus 100 during testing phase.
2993+
(101, attribution_data, option)
2994+
});
29862995

29872996
impl_writeable_msg!(UpdateFailMalformedHTLC, {
29882997
channel_id,
@@ -3971,6 +3980,7 @@ impl_writeable_msg!(GossipTimestampFilter, {
39713980
mod tests {
39723981
use bitcoin::{Amount, Transaction, TxIn, ScriptBuf, Sequence, Witness, TxOut};
39733982
use bitcoin::hex::DisplayHex;
3983+
use crate::ln::onion_utils::ATTRIBUTION_DATA_LEN;
39743984
use crate::ln::types::ChannelId;
39753985
use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret};
39763986
use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
@@ -4976,10 +4986,11 @@ mod tests {
49764986
let update_fail_htlc = msgs::UpdateFailHTLC {
49774987
channel_id: ChannelId::from_bytes([2; 32]),
49784988
htlc_id: 2316138423780173,
4979-
reason: [1; 32].to_vec()
4989+
reason: [1; 32].to_vec(),
4990+
attribution_data: Some([3; ATTRIBUTION_DATA_LEN])
49804991
};
49814992
let encoded_value = update_fail_htlc.encode();
4982-
let target_value = <Vec<u8>>::from_hex("020202020202020202020202020202020202020202020202020202020202020200083a840000034d00200101010101010101010101010101010101010101010101010101010101010101").unwrap();
4993+
let target_value = <Vec<u8>>::from_hex("020202020202020202020202020202020202020202020202020202020202020200083a840000034d0020010101010101010101010101010101010101010101010101010101010101010165fd03980303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303").unwrap();
49834994
assert_eq!(encoded_value, target_value);
49844995
}
49854996

lightning/src/ln/onion_payment.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ where
518518
channel_id: msg.channel_id,
519519
htlc_id: msg.htlc_id,
520520
reason: failure.data,
521+
attribution_data: failure.attribution_data,
521522
}));
522523
};
523524

lightning/src/ln/onion_route_tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ fn test_onion_failure() {
685685
decoded_err_packet.hmac = Hmac::from_engine(hmac).to_byte_array();
686686
let mut onion_error = OnionErrorPacket {
687687
data: decoded_err_packet.encode(),
688+
attribution_data: None,
688689
};
689690
onion_utils::test_crypt_failure_packet(
690691
&onion_keys[1].shared_secret.as_ref(), &mut onion_error);
@@ -712,6 +713,7 @@ fn test_onion_failure() {
712713
decoded_err_packet.hmac = Hmac::from_engine(hmac).to_byte_array();
713714
let mut onion_error = OnionErrorPacket{
714715
data: decoded_err_packet.encode(),
716+
attribution_data: None,
715717
};
716718
onion_utils::test_crypt_failure_packet(
717719
&onion_keys[0].shared_secret.as_ref(), &mut onion_error);
@@ -740,6 +742,7 @@ fn test_onion_failure() {
740742
decoded_err_packet.hmac = Hmac::from_engine(hmac).to_byte_array();
741743
let mut onion_error = OnionErrorPacket{
742744
data: decoded_err_packet.encode(),
745+
attribution_data: None,
743746
};
744747
onion_utils::test_crypt_failure_packet(
745748
&onion_keys[1].shared_secret.as_ref(), &mut onion_error);

0 commit comments

Comments
 (0)