Skip to content

Commit f1a52eb

Browse files
committed
Avoid slices without inner references
As we cannot express slices without inner references in bindings wrappers.
1 parent f65eca1 commit f1a52eb

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

lightning/src/blinded_path/payment.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl BlindedPaymentPath {
9595
// be in relation to a specific channel.
9696
let htlc_maximum_msat = u64::max_value();
9797
Self::new(
98-
&[], payee_node_id, payee_tlvs, htlc_maximum_msat, min_final_cltv_expiry_delta,
98+
Vec::new(), payee_node_id, payee_tlvs, htlc_maximum_msat, min_final_cltv_expiry_delta,
9999
entropy_source, secp_ctx
100100
)
101101
}
@@ -108,7 +108,7 @@ impl BlindedPaymentPath {
108108
/// * any unknown features are required in the provided [`ForwardTlvs`]
109109
// TODO: make all payloads the same size with padding + add dummy hops
110110
pub fn new<ES: Deref, T: secp256k1::Signing + secp256k1::Verification>(
111-
intermediate_nodes: &[PaymentForwardNode], payee_node_id: PublicKey,
111+
intermediate_nodes: Vec<PaymentForwardNode>, payee_node_id: PublicKey,
112112
payee_tlvs: ReceiveTlvs, htlc_maximum_msat: u64, min_final_cltv_expiry_delta: u16,
113113
entropy_source: ES, secp_ctx: &Secp256k1<T>,
114114
) -> Result<Self, ()> where ES::Target: EntropySource {
@@ -119,14 +119,14 @@ impl BlindedPaymentPath {
119119
let blinding_secret = SecretKey::from_slice(&blinding_secret_bytes[..]).expect("RNG is busted");
120120

121121
let blinded_payinfo = compute_payinfo(
122-
intermediate_nodes, &payee_tlvs.tlvs, htlc_maximum_msat, min_final_cltv_expiry_delta
122+
&intermediate_nodes, &payee_tlvs.tlvs, htlc_maximum_msat, min_final_cltv_expiry_delta
123123
)?;
124124
Ok(Self {
125125
inner_path: BlindedPath {
126126
introduction_node,
127127
blinding_point: PublicKey::from_secret_key(secp_ctx, &blinding_secret),
128128
blinded_hops: blinded_hops(
129-
secp_ctx, intermediate_nodes, payee_node_id, payee_tlvs, &blinding_secret
129+
secp_ctx, &intermediate_nodes, payee_node_id, payee_tlvs, &blinding_secret
130130
).map_err(|_| ())?,
131131
},
132132
payinfo: blinded_payinfo

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5387,7 +5387,7 @@ where
53875387
/// [`ChannelUnavailable`]: APIError::ChannelUnavailable
53885388
/// [`APIMisuseError`]: APIError::APIMisuseError
53895389
pub fn update_partial_channel_config(
5390-
&self, counterparty_node_id: &PublicKey, channel_ids: &[ChannelId], config_update: &ChannelConfigUpdate,
5390+
&self, counterparty_node_id: &PublicKey, channel_ids: Vec<ChannelId>, config_update: &ChannelConfigUpdate,
53915391
) -> Result<(), APIError> {
53925392
if config_update.cltv_expiry_delta.map(|delta| delta < MIN_CLTV_EXPIRY_DELTA).unwrap_or(false) {
53935393
return Err(APIError::APIMisuseError {
@@ -5402,14 +5402,14 @@ where
54025402
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
54035403
let peer_state = &mut *peer_state_lock;
54045404

5405-
for channel_id in channel_ids {
5405+
for channel_id in channel_ids.iter() {
54065406
if !peer_state.has_channel(channel_id) {
54075407
return Err(APIError::ChannelUnavailable {
54085408
err: format!("Channel with id {} not found for the passed counterparty node_id {}", channel_id, counterparty_node_id),
54095409
});
54105410
};
54115411
}
5412-
for channel_id in channel_ids {
5412+
for channel_id in channel_ids.iter() {
54135413
if let Some(channel_phase) = peer_state.channel_by_id.get_mut(channel_id) {
54145414
let mut config = channel_phase.context().config();
54155415
config.apply(config_update);
@@ -5464,7 +5464,7 @@ where
54645464
/// [`ChannelUnavailable`]: APIError::ChannelUnavailable
54655465
/// [`APIMisuseError`]: APIError::APIMisuseError
54665466
pub fn update_channel_config(
5467-
&self, counterparty_node_id: &PublicKey, channel_ids: &[ChannelId], config: &ChannelConfig,
5467+
&self, counterparty_node_id: &PublicKey, channel_ids: Vec<ChannelId>, config: &ChannelConfig,
54685468
) -> Result<(), APIError> {
54695469
return self.update_partial_channel_config(counterparty_node_id, channel_ids, &(*config).into());
54705470
}

lightning/src/routing/gossip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl NodeId {
9898
}
9999

100100
/// Get the public key as an array from this NodeId
101-
pub fn as_array(&self) -> &[u8; PUBLIC_KEY_SIZE] {
101+
pub fn as_array(&self) -> &[u8; 33] {
102102
&self.0
103103
}
104104

lightning/src/routing/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref, S: Deref> Router f
162162
})
163163
.map(|forward_node| {
164164
BlindedPaymentPath::new(
165-
&[forward_node], recipient, tlvs.clone(), u64::MAX, MIN_FINAL_CLTV_EXPIRY_DELTA,
165+
vec![forward_node], recipient, tlvs.clone(), u64::MAX, MIN_FINAL_CLTV_EXPIRY_DELTA,
166166
&*self.entropy_source, secp_ctx
167167
)
168168
})
@@ -174,7 +174,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref, S: Deref> Router f
174174
_ => {
175175
if network_graph.nodes().contains_key(&NodeId::from_pubkey(&recipient)) {
176176
BlindedPaymentPath::new(
177-
&[], recipient, tlvs, u64::MAX, MIN_FINAL_CLTV_EXPIRY_DELTA, &*self.entropy_source,
177+
Vec::new(), recipient, tlvs, u64::MAX, MIN_FINAL_CLTV_EXPIRY_DELTA, &*self.entropy_source,
178178
secp_ctx
179179
).map(|path| vec![path])
180180
} else {

0 commit comments

Comments
 (0)