Skip to content

Commit 6511395

Browse files
committed
f: older Rust version CI fixes for the façade method
1 parent f7e6dd6 commit 6511395

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -949,16 +949,16 @@ where
949949
_ => unreachable!(),
950950
};
951951

952-
let (outer_session_priv, inner_session_priv) = if path.has_trampoline_hops() {
952+
let secondary_session_priv = path.has_trampoline_hops().then(|| {
953953
// If we have Trampoline hops, the outer onion session_priv is a hash of the inner one.
954954
let session_priv_hash = Sha256::hash(&primary_session_priv.secret_bytes()).to_byte_array();
955-
(
956-
&SecretKey::from_slice(&session_priv_hash[..]).expect("You broke SHA-256!"),
957-
Some(primary_session_priv),
958-
)
959-
} else {
960-
(primary_session_priv, None)
961-
};
955+
SecretKey::from_slice(&session_priv_hash[..]).expect("You broke SHA-256!")
956+
});
957+
958+
// the outer onion's session priv is the secondary (if it's set), or the primary as its fallback
959+
let outer_session_priv = secondary_session_priv.as_ref().unwrap_or(primary_session_priv);
960+
// the inner onion's session priv is only set if there is a secondary
961+
let inner_session_priv = secondary_session_priv.as_ref().map(|_| primary_session_priv);
962962

963963
process_onion_failure_inner(
964964
secp_ctx,

0 commit comments

Comments
 (0)