From abee51b10c3aac329ede97efb510572f3026d7da Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 4 Nov 2023 16:20:24 +0000 Subject: [PATCH] Prefer `Writeable.encode()` over `VecWriter` use It does the same thing and its much simpler. --- lightning/src/blinded_path/utils.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lightning/src/blinded_path/utils.rs b/lightning/src/blinded_path/utils.rs index c62b4e6c2..33a2cde8c 100644 --- a/lightning/src/blinded_path/utils.rs +++ b/lightning/src/blinded_path/utils.rs @@ -20,7 +20,7 @@ use crate::ln::msgs::DecodeError; use crate::ln::onion_utils; use crate::onion_message::Destination; use crate::util::chacha20poly1305rfc::ChaChaPolyWriteAdapter; -use crate::util::ser::{Readable, VecWriter, Writeable}; +use crate::util::ser::{Readable, Writeable}; use crate::io; use crate::prelude::*; @@ -129,10 +129,8 @@ where /// Encrypt TLV payload to be used as a [`crate::blinded_path::BlindedHop::encrypted_payload`]. fn encrypt_payload(payload: P, encrypted_tlvs_rho: [u8; 32]) -> Vec { - let mut writer = VecWriter(Vec::new()); let write_adapter = ChaChaPolyWriteAdapter::new(encrypted_tlvs_rho, &payload); - write_adapter.write(&mut writer).expect("In-memory writes cannot fail"); - writer.0 + write_adapter.encode() } /// Blinded path encrypted payloads may be padded to ensure they are equal length. -- 2.39.5