use bitcoin::secp256k1::{PublicKey, Scalar, Secp256k1, SecretKey};
use crate::io::{Cursor, Read};
-use crate::prelude::*;
-use core::convert::{AsMut, TryInto};
use core::ops::Deref;
+#[allow(unused_imports)]
+use crate::prelude::*;
+
pub(crate) struct OnionKeys {
#[cfg(test)]
pub(crate) shared_secret: SharedSecret,
encrypted_tlvs: blinded_hop.encrypted_payload.clone(),
intro_node_blinding_point: blinding_point.take(),
keysend_preimage: *keysend_preimage,
+ custom_tlvs: recipient_onion.custom_tlvs.clone(),
});
} else {
res.push(msgs::OutboundOnionPayload::BlindedForward {
)
}
+#[allow(unused)]
+pub(super) fn construct_trampoline_onion_packet(
+ payloads: Vec<msgs::OutboundTrampolinePayload>, onion_keys: Vec<OnionKeys>,
+ prng_seed: [u8; 32], associated_data: &PaymentHash, length: u16,
+) -> Result<msgs::TrampolineOnionPacket, ()> {
+ let mut packet_data = vec![0u8; length as usize];
+
+ let mut chacha = ChaCha20::new(&prng_seed, &[0; 8]);
+ chacha.process(&vec![0u8; length as usize], &mut packet_data);
+
+ construct_onion_packet_with_init_noise::<_, _>(
+ payloads,
+ onion_keys,
+ packet_data,
+ Some(associated_data),
+ )
+}
+
#[cfg(test)]
/// Used in testing to write bogus `BogusOnionHopData` as well as `RawOnionHopData`, which is
/// otherwise not representable in `msgs::OnionHopData`.
},
}
+impl Hop {
+ pub(crate) fn is_intro_node_blinded_forward(&self) -> bool {
+ match self {
+ Self::Forward {
+ next_hop_data:
+ msgs::InboundOnionPayload::BlindedForward {
+ intro_node_blinding_point: Some(_), ..
+ },
+ ..
+ } => true,
+ _ => false,
+ }
+ }
+}
+
/// Error returned when we fail to decode the onion packet.
#[derive(Debug)]
pub(crate) enum OnionDecodeErr {
use crate::ln::features::{ChannelFeatures, NodeFeatures};
use crate::ln::msgs;
use crate::ln::PaymentHash;
- use crate::prelude::*;
use crate::routing::router::{Path, Route, RouteHop};
use crate::util::ser::{VecWriter, Writeable, Writer};
+ #[allow(unused_imports)]
+ use crate::prelude::*;
+
use bitcoin::hashes::hex::FromHex;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::{PublicKey, SecretKey};