Skip to content

Commit 8a9b108

Browse files
f use more realistic values for payload amt/cltv
1 parent fb67e9d commit 8a9b108

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
use crate::blinded_path::BlindedHop;
1111
use crate::crypto::chacha20::ChaCha20;
1212
use crate::crypto::streams::ChaChaReader;
13+
use crate::ln::channel::TOTAL_BITCOIN_SUPPLY_SATOSHIS;
1314
use crate::ln::channelmanager::{HTLCSource, RecipientOnionFields};
1415
use crate::ln::features::{ChannelFeatures, NodeFeatures};
1516
use crate::ln::msgs;
1617
use crate::ln::types::{PaymentHash, PaymentPreimage};
1718
use crate::ln::wire::Encode;
1819
use crate::routing::gossip::NetworkUpdate;
19-
use crate::routing::router::{
20-
Path, RouteHop, RouteParameters, DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, MAX_PATH_LENGTH_ESTIMATE,
21-
};
20+
use crate::routing::router::{Path, RouteHop, RouteParameters, MAX_PATH_LENGTH_ESTIMATE};
2221
use crate::sign::NodeSigner;
2322
use crate::util::errors::{self, APIError};
2423
use crate::util::logger::Logger;
@@ -322,8 +321,8 @@ pub(crate) fn set_max_path_length(
322321
const PAYLOAD_HMAC_LEN: usize = 32;
323322
let unblinded_intermed_payload_len = msgs::OutboundOnionPayload::Forward {
324323
short_channel_id: 42,
325-
amt_to_forward: u64::max_value(),
326-
outgoing_cltv_value: u32::max_value(),
324+
amt_to_forward: TOTAL_BITCOIN_SUPPLY_SATOSHIS,
325+
outgoing_cltv_value: route_params.payment_params.max_total_cltv_expiry_delta,
327326
}
328327
.serialized_length()
329328
.saturating_add(PAYLOAD_HMAC_LEN);
@@ -358,7 +357,7 @@ pub(crate) fn set_max_path_length(
358357
short_channel_id: 42,
359358
channel_features: ChannelFeatures::empty(),
360359
fee_msat: final_value_msat_with_overpay_buffer,
361-
cltv_expiry_delta: DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA,
360+
cltv_expiry_delta: route_params.payment_params.max_total_cltv_expiry_delta,
362361
maybe_announced_channel: false,
363362
};
364363
let mut num_reserved_bytes: usize = 0;

0 commit comments

Comments
 (0)