mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Set HTLCPreviousHopData::blinded for blinded received HTLCs.
Will be used in the next commit(s) to let us know to fail blinded received HTLCs backwards with the malformed and invalid_onion_blinding error per BOLT 4.
This commit is contained in:
parent
339f3fccf8
commit
e4485cffb3
1 changed files with 7 additions and 7 deletions
|
@ -201,11 +201,11 @@ pub struct BlindedForward {
|
||||||
impl PendingHTLCRouting {
|
impl PendingHTLCRouting {
|
||||||
// Used to override the onion failure code and data if the HTLC is blinded.
|
// Used to override the onion failure code and data if the HTLC is blinded.
|
||||||
fn blinded_failure(&self) -> Option<BlindedFailure> {
|
fn blinded_failure(&self) -> Option<BlindedFailure> {
|
||||||
// TODO: needs update when we support receiving to multi-hop blinded paths
|
// TODO: needs update when we support forwarding blinded HTLCs as non-intro node
|
||||||
if let Self::Forward { blinded: Some(_), .. } = self {
|
match self {
|
||||||
Some(BlindedFailure::FromIntroductionNode)
|
Self::Forward { blinded: Some(_), .. } => Some(BlindedFailure::FromIntroductionNode),
|
||||||
} else {
|
Self::Receive { requires_blinded_error: true, .. } => Some(BlindedFailure::FromBlindedNode),
|
||||||
None
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ pub(super) enum HTLCForwardInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for failing blinded HTLCs backwards correctly.
|
// Used for failing blinded HTLCs backwards correctly.
|
||||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
|
||||||
enum BlindedFailure {
|
enum BlindedFailure {
|
||||||
FromIntroductionNode,
|
FromIntroductionNode,
|
||||||
FromBlindedNode,
|
FromBlindedNode,
|
||||||
|
@ -4462,7 +4462,7 @@ where
|
||||||
htlc_id: $htlc.prev_hop.htlc_id,
|
htlc_id: $htlc.prev_hop.htlc_id,
|
||||||
incoming_packet_shared_secret: $htlc.prev_hop.incoming_packet_shared_secret,
|
incoming_packet_shared_secret: $htlc.prev_hop.incoming_packet_shared_secret,
|
||||||
phantom_shared_secret,
|
phantom_shared_secret,
|
||||||
blinded_failure: None,
|
blinded_failure,
|
||||||
}), payment_hash,
|
}), payment_hash,
|
||||||
HTLCFailReason::reason(0x4000 | 15, htlc_msat_height_data),
|
HTLCFailReason::reason(0x4000 | 15, htlc_msat_height_data),
|
||||||
HTLCDestination::FailedPayment { payment_hash: $payment_hash },
|
HTLCDestination::FailedPayment { payment_hash: $payment_hash },
|
||||||
|
|
Loading…
Add table
Reference in a new issue