use bitcoin::secp256k1::PublicKey;
use bitcoin::secp256k1::ecdh::SharedSecret;
-use crate::blinded_path::{BlindedPath, ForwardTlvs, ReceiveTlvs};
+use crate::blinded_path::BlindedPath;
+use crate::blinded_path::message::{ForwardTlvs, ReceiveTlvs};
+use crate::blinded_path::utils::Padding;
use crate::ln::msgs::DecodeError;
use crate::ln::onion_utils;
use super::messenger::CustomOnionMessageHandler;
Blinded(Vec<u8>),
/// If we're constructing an onion message hop through an intermediate unblinded node, we'll need
/// to construct the intermediate hop's control TLVs in their unblinded state to avoid encoding
- /// them into an intermediate Vec. See [`crate::blinded_path::ForwardTlvs`] for more info.
+ /// them into an intermediate Vec. See [`crate::blinded_path::message::ForwardTlvs`] for more
+ /// info.
Unblinded(ForwardTlvs),
}
pub(super) enum ReceiveControlTlvs {
/// See [`ForwardControlTlvs::Blinded`].
Blinded(Vec<u8>),
- /// See [`ForwardControlTlvs::Unblinded`] and [`crate::blinded_path::ReceiveTlvs`].
+ /// See [`ForwardControlTlvs::Unblinded`] and [`crate::blinded_path::message::ReceiveTlvs`].
Unblinded(ReceiveTlvs),
}
match &self.0 {
Payload::Forward(ForwardControlTlvs::Blinded(encrypted_bytes)) => {
_encode_varint_length_prefixed_tlv!(w, {
- (4, *encrypted_bytes, vec_type)
+ (4, *encrypted_bytes, required_vec)
})
},
Payload::Receive {
} => {
_encode_varint_length_prefixed_tlv!(w, {
(2, reply_path, option),
- (4, *encrypted_bytes, vec_type),
+ (4, *encrypted_bytes, required_vec),
(message.tlv_type(), message, required)
})
},
Ok(payload_fmt)
}
}
-
-/// Reads padding to the end, ignoring what's read.
-pub(crate) struct Padding {}
-impl Readable for Padding {
- #[inline]
- fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError> {
- loop {
- let mut buf = [0; 8192];
- if reader.read(&mut buf[..])? == 0 { break; }
- }
- Ok(Self {})
- }
-}