Skip to content

Commit ba2261c

Browse files
committed
f: Removed BlindedPathTlvsRef
1. In the following commit the Forward and Receive Tlvs within the BlindedPathTlvs will need to be modified. 2. To allow doing this, preemtively update the code to own the code, instead of an immutable reference.
1 parent 27a6edd commit ba2261c

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ pub(crate) enum BlindedPaymentTlvs {
8585
Receive(ReceiveTlvs),
8686
}
8787

88-
// Used to include forward and receive TLVs in the same iterator for encoding.
89-
#[derive(Clone)]
90-
enum BlindedPaymentTlvsRef<'a> {
91-
Forward(&'a ForwardTlvs),
92-
Receive(&'a ReceiveTlvs),
93-
}
94-
9588
/// Parameters for relaying over a given [`BlindedHop`].
9689
///
9790
/// [`BlindedHop`]: crate::blinded_path::BlindedHop
@@ -225,7 +218,7 @@ impl Writeable for ReceiveTlvs {
225218
}
226219
}
227220

228-
impl<'a> Writeable for BlindedPaymentTlvsRef<'a> {
221+
impl Writeable for BlindedPaymentTlvs {
229222
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
230223
match self {
231224
Self::Forward(tlvs) => tlvs.write(w)?,
@@ -276,8 +269,8 @@ pub(super) fn blinded_hops<T: secp256k1::Signing + secp256k1::Verification>(
276269
) -> Result<Vec<BlindedHop>, secp256k1::Error> {
277270
let pks = intermediate_nodes.iter().map(|node| &node.node_id)
278271
.chain(core::iter::once(&payee_node_id));
279-
let tlvs = intermediate_nodes.iter().map(|node| BlindedPaymentTlvsRef::Forward(&node.tlvs))
280-
.chain(core::iter::once(BlindedPaymentTlvsRef::Receive(&payee_tlvs)));
272+
let tlvs = intermediate_nodes.iter().map(|node| BlindedPaymentTlvs::Forward(node.tlvs.clone()))
273+
.chain(core::iter::once(BlindedPaymentTlvs::Receive(payee_tlvs)));
281274

282275
utils::construct_blinded_hops(secp_ctx, pks, tlvs, session_priv)
283276
}

0 commit comments

Comments
 (0)