Add `ChannelDetails::next_splice_out_maximum_sat`
What changed, and why it matters
This commit adds a new read-only field called next_splice_out_maximum_sat to the public ChannelDetails struct. It exposes how much bitcoin can be spliced out of a channel in the next splice operation. There is no change to logic, permissions, or cryptographic checks; it is purely an API/data exposure addition. No security issue is evident from the diff.
No security action required. Treat as a normal API addition; review whether exposing the splice-out maximum is acceptable from a privacy/information-leak perspective during normal code review, but no vulnerability is indicated.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces a new u64 field next_splice_out_maximum_sat on ChannelDetails, populates it from ChannelBalance, serializes it as TLV field 23 with a fallback default of outbound_capacity_msat / 1000, and updates fuzz/test/bench constructors. It is additive only and does not alter state machines, validation, or routing behavior beyond exposing the value.
Changed components
lightning/src/ln/channel_state.rslightning/src/routing/router.rsfuzz/src/router.rsInspect captured patch +8 / −0
diff --git a/fuzz/src/router.rs b/fuzz/src/router.rs
index 7c62b3a..2295ae3 100644
--- a/fuzz/src/router.rs
+++ b/fuzz/src/router.rs
@@ -248,6 +248,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
outbound_capacity_msat: capacity.saturating_mul(1000),
next_outbound_htlc_limit_msat: capacity.saturating_mul(1000),
next_outbound_htlc_minimum_msat: 0,
+ next_splice_out_maximum_sat: capacity,
inbound_htlc_minimum_msat: None,
inbound_htlc_maximum_msat: None,
config: None,
diff --git a/lightning/src/ln/channel_state.rs b/lightning/src/ln/channel_state.rs
index 39e5cae..28e8bed 100644
--- a/lightning/src/ln/channel_state.rs
+++ b/lightning/src/ln/channel_state.rs
@@ -399,6 +399,8 @@ pub struct ChannelDetails {
/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
/// route which is valid.
pub next_outbound_htlc_minimum_msat: u64,
+ /// The maximum value of the next splice out from our channel balance.
+ pub next_splice_out_maximum_sat: u64,
/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
/// available for inclusion in new inbound HTLCs).
@@ -599,6 +601,7 @@ impl ChannelDetails {
outbound_capacity_msat: balance.outbound_capacity_msat,
next_outbound_htlc_limit_msat: balance.next_outbound_htlc_limit_msat,
next_outbound_htlc_minimum_msat: balance.next_outbound_htlc_minimum_msat,
+ next_splice_out_maximum_sat: balance.next_splice_out_maximum_sat,
user_channel_id: context.get_user_id(),
confirmations_required: channel.minimum_depth(),
confirmations: Some(funding.get_funding_tx_confirmations(best_block_height)),
@@ -639,6 +642,7 @@ impl_writeable_tlv_based!(ChannelDetails, {
(20, inbound_capacity_msat, required),
(21, next_outbound_htlc_minimum_msat, (default_value, 0)),
(22, confirmations_required, option),
+ (23, next_splice_out_maximum_sat, (default_value, u64::from(outbound_capacity_msat.0.unwrap()) / 1000)),
(24, force_close_spend_delay, option),
(26, is_outbound, required),
(28, is_channel_ready, required),
@@ -744,6 +748,7 @@ mod tests {
outbound_capacity_msat: 24_300,
next_outbound_htlc_limit_msat: 20_000,
next_outbound_htlc_minimum_msat: 132,
+ next_splice_out_maximum_sat: 20,
inbound_capacity_msat: 42,
unspendable_punishment_reserve: Some(8273),
confirmations_required: Some(5),
diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs
index 18b78dd..6db5761 100644
--- a/lightning/src/routing/router.rs
+++ b/lightning/src/routing/router.rs
@@ -4150,6 +4150,7 @@ mod tests {
outbound_capacity_msat,
next_outbound_htlc_limit_msat: outbound_capacity_msat,
next_outbound_htlc_minimum_msat: 0,
+ next_splice_out_maximum_sat: outbound_capacity_msat / 1000,
inbound_capacity_msat: 42,
unspendable_punishment_reserve: None,
confirmations_required: None,
@@ -9650,6 +9651,7 @@ pub(crate) mod bench_utils {
outbound_capacity_msat: 10_000_000_000,
next_outbound_htlc_minimum_msat: 0,
next_outbound_htlc_limit_msat: 10_000_000_000,
+ next_splice_out_maximum_sat: 10_000_000,
inbound_capacity_msat: 0,
unspendable_punishment_reserve: None,
confirmations_required: None,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.