Skip to content

Commit 87359a3

Browse files
committed
f - make ReceiveTlvs::tlvs read-only
1 parent 26d27a2 commit 87359a3

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

fuzz/src/invoice_request_deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
114114
fee_base_msat: 1,
115115
},
116116
payment_constraints: PaymentConstraints {
117-
max_cltv_expiry: payee_tlvs.tlvs.payment_constraints.max_cltv_expiry + 40,
117+
max_cltv_expiry: payee_tlvs.tlvs().payment_constraints.max_cltv_expiry + 40,
118118
htlc_minimum_msat: 100,
119119
},
120120
features: BlindedHopFeatures::empty(),

fuzz/src/refund_deser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
9191
fee_base_msat: 1,
9292
},
9393
payment_constraints: PaymentConstraints {
94-
max_cltv_expiry: payee_tlvs.tlvs.payment_constraints.max_cltv_expiry + 40,
94+
max_cltv_expiry: payee_tlvs.tlvs().payment_constraints.max_cltv_expiry + 40,
9595
htlc_minimum_msat: 100,
9696
},
9797
features: BlindedHopFeatures::empty(),

lightning/src/blinded_path/payment.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,18 @@ pub struct ForwardTlvs {
262262
#[derive(Clone, Debug)]
263263
pub struct ReceiveTlvs {
264264
/// The TLVs for which the HMAC in `authentication` is derived.
265-
pub tlvs: UnauthenticatedReceiveTlvs,
265+
pub(crate) tlvs: UnauthenticatedReceiveTlvs,
266266
/// An HMAC of `tlvs` along with a nonce used to construct it.
267267
pub(crate) authentication: (Hmac<Sha256>, Nonce),
268268
}
269269

270+
impl ReceiveTlvs {
271+
/// Returns the underlying TLVs.
272+
pub fn tlvs(&self) -> &UnauthenticatedReceiveTlvs {
273+
&self.tlvs
274+
}
275+
}
276+
270277
/// An unauthenticated [`ReceiveTlvs`].
271278
#[derive(Clone, Debug)]
272279
pub struct UnauthenticatedReceiveTlvs {

lightning/src/routing/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref, S: Deref, SP: Size
145145

146146
let cltv_expiry_delta = payment_relay.cltv_expiry_delta as u32;
147147
let payment_constraints = PaymentConstraints {
148-
max_cltv_expiry: tlvs.tlvs.payment_constraints.max_cltv_expiry + cltv_expiry_delta,
148+
max_cltv_expiry: tlvs.tlvs().payment_constraints.max_cltv_expiry + cltv_expiry_delta,
149149
htlc_minimum_msat: details.inbound_htlc_minimum_msat.unwrap_or(0),
150150
};
151151
Some(PaymentForwardNode {

0 commit comments

Comments
 (0)