Skip to content

Commit 9888bbf

Browse files
committed
f: remove duplicated trampoline onion constraint checks
1 parent df22b62 commit 9888bbf

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

lightning/src/ln/onion_payment.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -652,20 +652,6 @@ where
652652
})
653653
}
654654
onion_utils::Hop::TrampolineForward { ref outer_hop_data, next_trampoline_hop_data: msgs::InboundTrampolineForwardPayload { amt_to_forward, outgoing_cltv_value, next_trampoline }, outer_shared_secret, trampoline_shared_secret, incoming_trampoline_public_key, .. } => {
655-
if let Err(reason) = check_trampoline_onion_constraints(outer_hop_data, outgoing_cltv_value, amt_to_forward) {
656-
let mut data = Vec::new();
657-
match reason {
658-
LocalHTLCFailureReason::FinalIncorrectCLTVExpiry => {
659-
outer_hop_data.outgoing_cltv_value.write(&mut data).unwrap();
660-
}
661-
LocalHTLCFailureReason::FinalIncorrectHTLCAmount => {
662-
outer_hop_data.amt_to_forward.write(&mut data).unwrap();
663-
}
664-
_ => unreachable!()
665-
}
666-
return encode_relay_error("Underflow calculating outbound amount or CLTV value for Trampoline forward",
667-
reason, outer_shared_secret.secret_bytes(), Some(trampoline_shared_secret.secret_bytes()), &data);
668-
}
669655
let next_trampoline_packet_pubkey = onion_utils::next_hop_pubkey(secp_ctx,
670656
incoming_trampoline_public_key, &trampoline_shared_secret.secret_bytes());
671657
Some(NextPacketDetails {
@@ -685,20 +671,6 @@ where
685671
LocalHTLCFailureReason::InvalidOnionBlinding, outer_shared_secret.secret_bytes(), Some(trampoline_shared_secret.secret_bytes()), &[0; 32]);
686672
}
687673
};
688-
if let Err(reason) = check_trampoline_onion_constraints(outer_hop_data, outgoing_cltv_value, amt_to_forward) {
689-
let mut data = Vec::new();
690-
match reason {
691-
LocalHTLCFailureReason::FinalIncorrectCLTVExpiry => {
692-
outer_hop_data.outgoing_cltv_value.write(&mut data).unwrap();
693-
}
694-
LocalHTLCFailureReason::FinalIncorrectHTLCAmount => {
695-
outer_hop_data.amt_to_forward.write(&mut data).unwrap();
696-
}
697-
_ => unreachable!()
698-
}
699-
return encode_relay_error("Underflow calculating outbound amount or CLTV value for Trampoline forward",
700-
reason, outer_shared_secret.secret_bytes(), Some(trampoline_shared_secret.secret_bytes()), &data);
701-
}
702674
let next_trampoline_packet_pubkey = onion_utils::next_hop_pubkey(secp_ctx,
703675
incoming_trampoline_public_key, &trampoline_shared_secret.secret_bytes());
704676
Some(NextPacketDetails {

0 commit comments

Comments
 (0)