Skip to content

Commit

Permalink
expose feerate_per_kw in ChannelDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
johncantrell97 committed Mar 9, 2023
1 parent 36834b3 commit f5f774c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lightning/src/ln/channelmanager.rs
Expand Up @@ -1118,6 +1118,10 @@ pub struct ChannelDetails {
/// inbound. This may be zero for inbound channels serialized with LDK versions prior to
/// 0.0.113.
pub user_channel_id: u128,
/// The currently negotiated feerate per 1000-weight-unit applied to commitment and htlc txs
///
/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
pub feerate_per_kw: Option<u32>,
/// Our total balance. This is the amount we would get if we close the channel.
/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
/// amount is not likely to be recoverable on close.
Expand Down Expand Up @@ -1260,6 +1264,7 @@ impl ChannelDetails {
outbound_scid_alias: if channel.is_usable() { Some(channel.outbound_scid_alias()) } else { None },
inbound_scid_alias: channel.latest_inbound_scid_alias(),
channel_value_satoshis: channel.get_value_satoshis(),
feerate_per_kw: Some(channel.get_feerate()),
unspendable_punishment_reserve: to_self_reserve_satoshis,
balance_msat: balance.balance_msat,
inbound_capacity_msat: balance.inbound_capacity_msat,
Expand Down Expand Up @@ -6570,6 +6575,7 @@ impl Writeable for ChannelDetails {
(33, self.inbound_htlc_minimum_msat, option),
(35, self.inbound_htlc_maximum_msat, option),
(37, user_channel_id_high_opt, option),
(39, self.feerate_per_kw, option),
});
Ok(())
}
Expand Down Expand Up @@ -6605,6 +6611,7 @@ impl Readable for ChannelDetails {
(33, inbound_htlc_minimum_msat, option),
(35, inbound_htlc_maximum_msat, option),
(37, user_channel_id_high_opt, option),
(39, feerate_per_kw, option),
});

// `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with
Expand Down Expand Up @@ -6638,6 +6645,7 @@ impl Readable for ChannelDetails {
is_public: is_public.0.unwrap(),
inbound_htlc_minimum_msat,
inbound_htlc_maximum_msat,
feerate_per_kw,
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/routing/router.rs
Expand Up @@ -2208,6 +2208,7 @@ mod tests {
inbound_htlc_minimum_msat: None,
inbound_htlc_maximum_msat: None,
config: None,
feerate_per_kw: None
}
}

Expand Down Expand Up @@ -5737,6 +5738,7 @@ mod benches {
inbound_htlc_minimum_msat: None,
inbound_htlc_maximum_msat: None,
config: None,
feerate_per_kw: None,
}
}

Expand Down

0 comments on commit f5f774c

Please sign in to comment.