Skip to content

Commit 30cc23a

Browse files
Replace max_channel_saturation_power_of_half hardcode with const
1 parent d546ffb commit 30cc23a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lightning/src/routing/router.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ pub const DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA: u32 = 1008;
481481
// limits, but for now more than 10 paths likely carries too much one-path failure.
482482
pub const DEFAULT_MAX_PATH_COUNT: u8 = 10;
483483

484+
const DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF: u8 = 2;
485+
484486
// The median hop CLTV expiry delta currently seen in the network.
485487
const MEDIAN_HOP_CLTV_EXPIRY_DELTA: u32 = 40;
486488

@@ -567,7 +569,7 @@ impl ReadableArgs<u32> for PaymentParameters {
567569
(2, features, (option: ReadableArgs, payee_pubkey.is_some())),
568570
(3, max_path_count, (default_value, DEFAULT_MAX_PATH_COUNT)),
569571
(4, route_hints, vec_type),
570-
(5, max_channel_saturation_power_of_half, (default_value, 2)),
572+
(5, max_channel_saturation_power_of_half, (default_value, DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF)),
571573
(6, expiry_time, option),
572574
(7, previously_failed_channels, vec_type),
573575
(8, blinded_route_hints, optional_vec),
@@ -612,7 +614,7 @@ impl PaymentParameters {
612614
expiry_time: None,
613615
max_total_cltv_expiry_delta: DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA,
614616
max_path_count: DEFAULT_MAX_PATH_COUNT,
615-
max_channel_saturation_power_of_half: 2,
617+
max_channel_saturation_power_of_half: DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF,
616618
previously_failed_channels: Vec::new(),
617619
}
618620
}
@@ -641,7 +643,7 @@ impl PaymentParameters {
641643
expiry_time: None,
642644
max_total_cltv_expiry_delta: DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA,
643645
max_path_count: DEFAULT_MAX_PATH_COUNT,
644-
max_channel_saturation_power_of_half: 2,
646+
max_channel_saturation_power_of_half: DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF,
645647
previously_failed_channels: Vec::new(),
646648
}
647649
}

0 commit comments

Comments
 (0)