Skip to content

Commit 7694260

Browse files
authored
Merge pull request #4547 from lexe-app/phlip9/channel-config-helper
util: add helper ChannelHandshakeConfig -> ChannelHandshakeConfigUpdate
2 parents e26f750 + 484ecb8 commit 7694260

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lightning/src/util/config.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,26 @@ pub struct ChannelHandshakeConfigUpdate {
12301230
pub channel_reserve_proportional_millionths: Option<u32>,
12311231
}
12321232

1233+
impl From<ChannelHandshakeConfig> for ChannelHandshakeConfigUpdate {
1234+
fn from(config: ChannelHandshakeConfig) -> Self {
1235+
Self {
1236+
announced_channel_max_inbound_htlc_value_in_flight_percentage: Some(
1237+
config.announced_channel_max_inbound_htlc_value_in_flight_percentage,
1238+
),
1239+
unannounced_channel_max_inbound_htlc_value_in_flight_percentage: Some(
1240+
config.unannounced_channel_max_inbound_htlc_value_in_flight_percentage,
1241+
),
1242+
htlc_minimum_msat: Some(config.our_htlc_minimum_msat),
1243+
minimum_depth: Some(config.minimum_depth),
1244+
to_self_delay: Some(config.our_to_self_delay),
1245+
max_accepted_htlcs: Some(config.our_max_accepted_htlcs),
1246+
channel_reserve_proportional_millionths: Some(
1247+
config.their_channel_reserve_proportional_millionths,
1248+
),
1249+
}
1250+
}
1251+
}
1252+
12331253
impl ChannelHandshakeConfig {
12341254
/// Applies the provided handshake config update.
12351255
pub fn apply(&mut self, config: &ChannelHandshakeConfigUpdate) {

0 commit comments

Comments
 (0)