Skip to content

Commit e3f64fd

Browse files
Merge pull request #4318 from tnull/2026-01-drop-max-funding-satoshis
Drop `ChannelHandshakeLimits::max_funding_satoshis`
2 parents 2647583 + 4bb33b2 commit e3f64fd

4 files changed

Lines changed: 5 additions & 46 deletions

File tree

fuzz/src/full_stack.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
11701170
// our network key
11711171
ext_from_hex("0100000000000000000000000000000000000000000000000000000000000000", &mut test);
11721172
// config
1173-
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff0001000000000000", &mut test);
1173+
ext_from_hex("000000000090000000000000000064000100000000000100ffff00000000000000ffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff0001000000000000", &mut test);
11741174

11751175
// new outbound connection with id 0
11761176
ext_from_hex("00", &mut test);
@@ -1624,7 +1624,7 @@ fn gossip_exchange_seed() -> Vec<u8> {
16241624
// our network key
16251625
ext_from_hex("0100000000000000000000000000000000000000000000000000000000000000", &mut test);
16261626
// config
1627-
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff0001000000000000", &mut test);
1627+
ext_from_hex("000000000090000000000000000064000100000000000100ffff00000000000000ffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff0001000000000000", &mut test);
16281628

16291629
// new outbound connection with id 0
16301630
ext_from_hex("00", &mut test);
@@ -1706,7 +1706,7 @@ fn splice_seed() -> Vec<u8> {
17061706
// our network key
17071707
ext_from_hex("0100000000000000000000000000000000000000000000000000000000000000", &mut test);
17081708
// config
1709-
ext_from_hex("000000000090000000000000000064000100000000000100ffff0000000000000000ffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff0001000000000000", &mut test);
1709+
ext_from_hex("000000000090000000000000000064000100000000000100ffff00000000000000ffffffffffffffffff0000000000000000ffffffffffffffff000000ffffffff00ffff1a000400010000020400000000040200000a08ffffffffffffffff0001000000000000", &mut test);
17101710

17111711
// new outbound connection with id 0
17121712
ext_from_hex("00", &mut test);

lightning/src/ln/channel.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3563,13 +3563,6 @@ impl<SP: SignerProvider> ChannelContext<SP> {
35633563
return Err(ChannelError::close(format!("Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks. It must be greater than {}", config.channel_handshake_config.our_to_self_delay, BREAKDOWN_TIMEOUT)));
35643564
}
35653565

3566-
// Check sanity of message fields:
3567-
if channel_value_satoshis > config.channel_handshake_limits.max_funding_satoshis {
3568-
return Err(ChannelError::close(format!(
3569-
"Per our config, funding must be at most {}. It was {}. Peer contribution: {}. Our contribution: {}",
3570-
config.channel_handshake_limits.max_funding_satoshis, channel_value_satoshis,
3571-
open_channel_fields.funding_satoshis, our_funding_satoshis)));
3572-
}
35733566
if channel_value_satoshis >= TOTAL_BITCOIN_SUPPLY_SATOSHIS {
35743567
return Err(ChannelError::close(format!("Funding must be smaller than the total bitcoin supply. It was {}", channel_value_satoshis)));
35753568
}
@@ -16046,10 +16039,7 @@ mod tests {
1604616039
AwaitingChannelReadyFlags, ChannelState, FundedChannel, HTLCCandidate, HTLCInitiator,
1604716040
HTLCUpdateAwaitingACK, InboundHTLCOutput, InboundHTLCState, InboundUpdateAdd,
1604816041
InboundV1Channel, OutboundHTLCOutput, OutboundHTLCState, OutboundV1Channel,
16049-
};
16050-
use crate::ln::channel::{
16051-
MAX_FUNDING_SATOSHIS_NO_WUMBO, MIN_THEIR_CHAN_RESERVE_SATOSHIS,
16052-
TOTAL_BITCOIN_SUPPLY_SATOSHIS,
16042+
MIN_THEIR_CHAN_RESERVE_SATOSHIS,
1605316043
};
1605416044
use crate::ln::channel_keys::{RevocationBasepoint, RevocationKey};
1605516045
use crate::ln::channelmanager::{self, HTLCSource, PaymentId};
@@ -16106,15 +16096,6 @@ mod tests {
1610616096
assert!(ChannelState::ChannelReady(ChannelReadyFlags::new()) < ChannelState::ShutdownComplete);
1610716097
}
1610816098

16109-
#[test]
16110-
fn test_max_funding_satoshis_no_wumbo() {
16111-
assert_eq!(TOTAL_BITCOIN_SUPPLY_SATOSHIS, 21_000_000 * 100_000_000);
16112-
assert!(
16113-
MAX_FUNDING_SATOSHIS_NO_WUMBO <= TOTAL_BITCOIN_SUPPLY_SATOSHIS,
16114-
"MAX_FUNDING_SATOSHIS_NO_WUMBO is greater than all satoshis in existence"
16115-
);
16116-
}
16117-
1611816099
#[cfg(ldk_test_vectors)]
1611916100
struct Keys {
1612016101
signer: crate::sign::InMemorySigner,

lightning/src/ln/channel_open_tests.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ fn test_channel_resumption_fail_post_funding() {
457457
pub fn test_insane_channel_opens() {
458458
// Stand up a network of 2 nodes
459459
use crate::ln::channel::TOTAL_BITCOIN_SUPPLY_SATOSHIS;
460-
let mut legacy_cfg = test_legacy_channel_config();
461-
legacy_cfg.channel_handshake_limits.max_funding_satoshis = TOTAL_BITCOIN_SUPPLY_SATOSHIS + 1;
460+
let legacy_cfg = test_legacy_channel_config();
462461
let chanmon_cfgs = create_chanmon_cfgs(2);
463462
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
464463
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(legacy_cfg.clone())]);
@@ -524,19 +523,6 @@ pub fn test_insane_channel_opens() {
524523

525524
use crate::ln::channelmanager::MAX_LOCAL_BREAKDOWN_TIMEOUT;
526525

527-
// Test all mutations that would make the channel open message insane
528-
insane_open_helper(
529-
format!(
530-
"Per our config, funding must be at most {}. It was {}",
531-
TOTAL_BITCOIN_SUPPLY_SATOSHIS + 1,
532-
TOTAL_BITCOIN_SUPPLY_SATOSHIS + 2
533-
)
534-
.as_str(),
535-
|mut msg| {
536-
msg.common_fields.funding_satoshis = TOTAL_BITCOIN_SUPPLY_SATOSHIS + 2;
537-
msg
538-
},
539-
);
540526
insane_open_helper(
541527
format!(
542528
"Funding must be smaller than the total bitcoin supply. It was {}",

lightning/src/util/config.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//! Various user-configurable channel limits and settings which ChannelManager
1111
//! applies for you.
1212
13-
use crate::ln::channel::MAX_FUNDING_SATOSHIS_NO_WUMBO;
1413
use crate::ln::channelmanager::{BREAKDOWN_TIMEOUT, MAX_LOCAL_BREAKDOWN_TIMEOUT};
1514

1615
#[cfg(fuzzing)]
@@ -300,11 +299,6 @@ pub struct ChannelHandshakeLimits {
300299
/// Default value: `1000`
301300
/// (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`])
302301
pub min_funding_satoshis: u64,
303-
/// Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
304-
/// only applies to inbound channels.
305-
///
306-
/// Default value: `2^24 - 1`
307-
pub max_funding_satoshis: u64,
308302
/// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
309303
/// you to limit the maximum minimum-size they can require.
310304
///
@@ -374,7 +368,6 @@ impl Default for ChannelHandshakeLimits {
374368
fn default() -> Self {
375369
ChannelHandshakeLimits {
376370
min_funding_satoshis: 1000,
377-
max_funding_satoshis: MAX_FUNDING_SATOSHIS_NO_WUMBO,
378371
max_htlc_minimum_msat: u64::MAX,
379372
min_max_htlc_value_in_flight_msat: 0,
380373
max_channel_reserve_satoshis: u64::MAX,
@@ -395,7 +388,6 @@ impl Readable for ChannelHandshakeLimits {
395388
fn read<R: crate::io::Read>(reader: &mut R) -> Result<Self, crate::ln::msgs::DecodeError> {
396389
Ok(Self {
397390
min_funding_satoshis: Readable::read(reader)?,
398-
max_funding_satoshis: Readable::read(reader)?,
399391
max_htlc_minimum_msat: Readable::read(reader)?,
400392
min_max_htlc_value_in_flight_msat: Readable::read(reader)?,
401393
max_channel_reserve_satoshis: Readable::read(reader)?,

0 commit comments

Comments
 (0)