What changed, and why it matters
This commit is a cleanup of data-type documentation and API definitions. It changes several numeric fields from being labeled as 32-bit unsigned integers to 16-bit unsigned integers, matching what the underlying code already used on the wire and in memory. It also removes an unused field called 'next_step' from the public API. There is no direct security vulnerability here, but it reduces the chance that future developers or API consumers will be confused about valid value ranges.
No immediate action required. Treat as a normal API consistency/documentation update. If you maintain API clients, verify they handle uint16 ranges for the affected fields and remove any dependency on the removed 'next_step' field.
Security signals we found
Type narrowing to match wire format reduces risk of API consumers sending out-of-range values
Removal of unused 'next_step' field simplifies the API surface
No change to runtime validation logic or cryptographic operations
No memory-safety, authentication, or authorization changes
Evidence from the diff
The patch updates API schemas, generated protobuf definitions, Rust model types, and test expectations so that sidecar/routing-fee fields (sets_fee_basis, funding_weight, channel_fee_max_proportional_thousands) and channel fields (to_self_delay, max_accepted_htlcs) are declared as uint16 instead of uint32. The values were already constrained to uint16 by the wire protocol and internal structs; the change only aligns the public-facing types with that reality. It also drops the ‘next_step’ field from the listchannels response, which appears to have been unused/deprecated.
Changed components
public API schemas (JSON)gRPC/protobuf definitionsRust API model types (trezor/trezor-firmware style)Python test fixturesInspect captured patch +1089 / −1108
### cln-grpc/proto/node.proto
@@ -1501,7 +1501,6 @@ message ListpeerchannelsChannels {
optional string initial_feerate = 12;
optional string last_feerate = 13;
optional string next_feerate = 14;
- optional uint32 next_fee_step = 15;
repeated ListpeerchannelsChannelsInflight inflight = 16;
optional bytes close_to = 17;
optional bool private = 18;
@@ -1548,8 +1547,8 @@ message ListpeerchannelsChannels {
optional Amount their_max_htlc_value_in_flight_msat = 61;
optional Amount our_max_htlc_value_in_flight_msat = 62;
repeated string features = 63;
- reserved 21, 30;
- reserved "max_total_htlc_in_msat";
+ reserved 15, 21, 30;
+ reserved "max_total_htlc_in_msat", "next_fee_step";
}
message ListpeerchannelsChannelsAlias {
### cln-grpc/src/convert.rs
@@ -963,11 +963,11 @@ impl From<responses::ListnodesNodesOptionWillFund> for pb::ListnodesNodesOptionW
fn from(c: responses::ListnodesNodesOptionWillFund) -> Self {
Self {
channel_fee_max_base_msat: Some(c.channel_fee_max_base_msat.into()), // Rule #2 for type msat
- channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #2 for type u32
+ channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths.into(), // Rule #2 for type u16
compact_lease: hex::decode(&c.compact_lease).unwrap(), // Rule #2 for type hex
- funding_weight: c.funding_weight, // Rule #2 for type u32
+ funding_weight: c.funding_weight.into(), // Rule #2 for type u16
lease_fee_base_msat: Some(c.lease_fee_base_msat.into()), // Rule #2 for type msat
- lease_fee_basis: c.lease_fee_basis, // Rule #2 for type u32
+ lease_fee_basis: c.lease_fee_basis.into(), // Rule #2 for type u16
}
}
}
@@ -1402,18 +1402,17 @@ impl From<responses::ListpeerchannelsChannels> for pb::ListpeerchannelsChannels
last_stable_connection: c.last_stable_connection, // Rule #2 for type u64?
last_tx_fee_msat: c.last_tx_fee_msat.map(|f| f.into()), // Rule #2 for type msat?
lost_state: c.lost_state, // Rule #2 for type boolean?
- max_accepted_htlcs: c.max_accepted_htlcs, // Rule #2 for type u32?
+ max_accepted_htlcs: c.max_accepted_htlcs.map(|v| v.into()), // Rule #2 for type u16?
max_to_us_msat: c.max_to_us_msat.map(|f| f.into()), // Rule #2 for type msat?
maximum_htlc_out_msat: c.maximum_htlc_out_msat.map(|f| f.into()), // Rule #2 for type msat?
min_to_us_msat: c.min_to_us_msat.map(|f| f.into()), // Rule #2 for type msat?
minimum_htlc_in_msat: c.minimum_htlc_in_msat.map(|f| f.into()), // Rule #2 for type msat?
minimum_htlc_out_msat: c.minimum_htlc_out_msat.map(|f| f.into()), // Rule #2 for type msat?
- next_fee_step: c.next_fee_step, // Rule #2 for type u32?
next_feerate: c.next_feerate, // Rule #2 for type string?
opener: c.opener as i32,
our_max_htlc_value_in_flight_msat: c.our_max_htlc_value_in_flight_msat.map(|f| f.into()), // Rule #2 for type msat?
our_reserve_msat: c.our_reserve_msat.map(|f| f.into()), // Rule #2 for type msat?
- our_to_self_delay: c.our_to_self_delay, // Rule #2 for type u32?
+ our_to_self_delay: c.our_to_self_delay.map(|v| v.into()), // Rule #2 for type u16?
out_fulfilled_msat: c.out_fulfilled_msat.map(|f| f.into()), // Rule #2 for type msat?
out_offered_msat: c.out_offered_msat.map(|f| f.into()), // Rule #2 for type msat?
out_payments_fulfilled: c.out_payments_fulfilled, // Rule #2 for type u64?
@@ -1434,7 +1433,7 @@ impl From<responses::ListpeerchannelsChannels> for pb::ListpeerchannelsChannels
status: c.status.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
their_max_htlc_value_in_flight_msat: c.their_max_htlc_value_in_flight_msat.map(|f| f.into()), // Rule #2 for type msat?
their_reserve_msat: c.their_reserve_msat.map(|f| f.into()), // Rule #2 for type msat?
- their_to_self_delay: c.their_to_self_delay, // Rule #2 for type u32?
+ their_to_self_delay: c.their_to_self_delay.map(|v| v.into()), // Rule #2 for type u16?
to_us_msat: c.to_us_msat.map(|f| f.into()), // Rule #2 for type msat?
total_msat: c.total_msat.map(|f| f.into()), // Rule #2 for type msat?
updates: c.updates.map(|v| v.into()),
@@ -2192,13 +2191,13 @@ impl From<responses::FunderupdateResponse> for pb::FunderupdateResponse {
fn from(c: responses::FunderupdateResponse) -> Self {
Self {
channel_fee_max_base_msat: c.channel_fee_max_base_msat.map(|f| f.into()), // Rule #2 for type msat?
- channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #2 for type u32?
+ channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths.map(|v| v.into()), // Rule #2 for type u16?
compact_lease: c.compact_lease.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex?
fund_probability: c.fund_probability, // Rule #2 for type u32
- funding_weight: c.funding_weight, // Rule #2 for type u32?
+ funding_weight: c.funding_weight.map(|v| v.into()), // Rule #2 for type u16?
fuzz_percent: c.fuzz_percent, // Rule #2 for type u32
lease_fee_base_msat: c.lease_fee_base_msat.map(|f| f.into()), // Rule #2 for type msat?
- lease_fee_basis: c.lease_fee_basis, // Rule #2 for type u32?
+ lease_fee_basis: c.lease_fee_basis.map(|v| v.into()), // Rule #2 for type u16?
leases_only: c.leases_only, // Rule #2 for type boolean
max_their_funding_msat: Some(c.max_their_funding_msat.into()), // Rule #2 for type msat
min_their_funding_msat: Some(c.min_their_funding_msat.into()), // Rule #2 for type msat
@@ -6320,13 +6319,13 @@ impl From<requests::FunderupdateRequest> for pb::FunderupdateRequest {
fn from(c: requests::FunderupdateRequest) -> Self {
Self {
channel_fee_max_base_msat: c.channel_fee_max_base_msat.map(|f| f.into()), // Rule #2 for type msat?
- channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #2 for type u32?
+ channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths.map(|v| v.into()), // Rule #2 for type u16?
compact_lease: c.compact_lease.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex?
fund_probability: c.fund_probability, // Rule #2 for type u32?
- funding_weight: c.funding_weight, // Rule #2 for type u32?
+ funding_weight: c.funding_weight.map(|v| v.into()), // Rule #2 for type u16?
fuzz_percent: c.fuzz_percent, // Rule #2 for type u32?
lease_fee_base_msat: c.lease_fee_base_msat.map(|f| f.into()), // Rule #2 for type msat?
- lease_fee_basis: c.lease_fee_basis, // Rule #2 for type u32?
+ lease_fee_basis: c.lease_fee_basis.map(|v| v.into()), // Rule #2 for type u16?
leases_only: c.leases_only, // Rule #2 for type boolean?
max_their_funding_msat: c.max_their_funding_msat.map(|f| f.into()), // Rule #2 for type msat?
min_their_funding_msat: c.min_their_funding_msat.map(|f| f.into()), // Rule #2 for type msat?
@@ -8537,13 +8536,13 @@ impl TryFrom<pb::FunderupdateRequest> for requests::FunderupdateRequest {
fn try_from(c: pb::FunderupdateRequest) -> Result<Self, Self::Error> {
Ok(Self {
channel_fee_max_base_msat: c.channel_fee_max_base_msat.map(|a| a.into()), // Rule #1 for type msat?
- channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths, // Rule #1 for type u32?
+ channel_fee_max_proportional_thousandths: c.channel_fee_max_proportional_thousandths.map(|v| u16::try_from(v).map_err(|e| invalid_argument("channel_fee_max_proportional_thousandths", e))).transpose()?, // Rule #1 for type u16?
compact_lease: c.compact_lease.map(|v| hex::encode(v)), // Rule #1 for type hex?
fund_probability: c.fund_probability, // Rule #1 for type u32?
- funding_weight: c.funding_weight, // Rule #1 for type u32?
+ funding_weight: c.funding_weight.map(|v| u16::try_from(v).map_err(|e| invalid_argument("funding_weight", e))).transpose()?, // Rule #1 for type u16?
fuzz_percent: c.fuzz_percent, // Rule #1 for type u32?
lease_fee_base_msat: c.lease_fee_base_msat.map(|a| a.into()), // Rule #1 for type msat?
- lease_fee_basis: c.lease_fee_basis, // Rule #1 for type u32?
+ lease_fee_basis: c.lease_fee_basis.map(|v| u16::try_from(v).map_err(|e| invalid_argument("lease_fee_basis", e))).transpose()?, // Rule #1 for type u16?
leases_only: c.leases_only, // Rule #1 for type boolean?
max_their_funding_msat: c.max_their_funding_msat.map(|a| a.into()), // Rule #1 for type msat?
min_their_funding_msat: c.min_their_funding_msat.map(|a| a.into()), // Rule #1 for type msat?
### cln-rpc/src/model.rs
@@ -2708,19 +2708,19 @@ pub mod requests {
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_fee_max_base_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub channel_fee_max_proportional_thousandths: Option<u32>,
+ pub channel_fee_max_proportional_thousandths: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub compact_lease: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub fund_probability: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub funding_weight: Option<u32>,
+ pub funding_weight: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub fuzz_percent: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub lease_fee_base_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub lease_fee_basis: Option<u32>,
+ pub lease_fee_basis: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub leases_only: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -7203,11 +7203,11 @@ pub mod responses {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ListnodesNodesOptionWillFund {
pub channel_fee_max_base_msat: Amount,
- pub channel_fee_max_proportional_thousandths: u32,
+ pub channel_fee_max_proportional_thousandths: u16,
pub compact_lease: String,
- pub funding_weight: u32,
+ pub funding_weight: u16,
pub lease_fee_base_msat: Amount,
- pub lease_fee_basis: u32,
+ pub lease_fee_basis: u16,
}
/// ['Type of connection (until 23.08, `websocket` was also allowed).']
@@ -7992,7 +7992,7 @@ pub mod responses {
#[serde(skip_serializing_if = "Option::is_none")]
pub lost_state: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub max_accepted_htlcs: Option<u32>,
+ pub max_accepted_htlcs: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub max_to_us_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -8004,15 +8004,13 @@ pub mod responses {
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_htlc_out_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub next_fee_step: Option<u32>,
- #[serde(skip_serializing_if = "Option::is_none")]
pub next_feerate: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub our_max_htlc_value_in_flight_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
pub our_reserve_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub our_to_self_delay: Option<u32>,
+ pub our_to_self_delay: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub out_fulfilled_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -8040,7 +8038,7 @@ pub mod responses {
#[serde(skip_serializing_if = "Option::is_none")]
pub their_reserve_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub their_to_self_delay: Option<u32>,
+ pub their_to_self_delay: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub to_us_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -9218,15 +9216,15 @@ pub mod responses {
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_fee_max_base_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub channel_fee_max_proportional_thousandths: Option<u32>,
+ pub channel_fee_max_proportional_thousandths: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub compact_lease: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub funding_weight: Option<u32>,
+ pub funding_weight: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub lease_fee_base_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
- pub lease_fee_basis: Option<u32>,
+ pub lease_fee_basis: Option<u16>,
// Path `FunderUpdate.policy`
pub policy: FunderupdatePolicy,
pub fund_probability: u32,
### contrib/msggen/msggen/schema.json
@@ -15745,14 +15745,14 @@
"default": "2k sats"
},
"lease_fee_basis": {
- "type": "u32",
+ "type": "u16",
"description": [
"A basis fee that's calculated as 1/10k of the total requested funds the peer is asking for. Node will receive the total of *lease_fee_basis* times requested funds / 10k satoshis added to their channel balance, paid by the opening node."
],
"default": "0.65% (65 basis points)"
},
"funding_weight": {
- "type": "u32",
+ "type": "u16",
"description": [
"To calculate the fee the peer will compensate your node for its contributing inputs to the funding transaction. The total fee is calculated as the `open_channel2`.`funding_feerate_perkw` times this *funding_weight* divided by 1000. Node will have this funding fee added to their channel balance, paid by the opening node."
],
@@ -15766,7 +15766,7 @@
"default": "5k sats"
},
"channel_fee_max_proportional_thousandths": {
- "type": "u32",
+ "type": "u16",
"description": [
"A commitment to a maximum `channel_fee_proportional_millionths` that your node will charge for routing payments over this leased channel during the lease duration. Note that it's denominated in 'thousandths'. A setting of `1` is equal to 1k ppm; `5` is 5k ppm, etc."
],
@@ -15874,13 +15874,13 @@
]
},
"lease_fee_basis": {
- "type": "u32",
+ "type": "u16",
"description": [
"Proportional fee to charge for a channel lease, calculated as 1/10,000th of requested funds."
]
},
"funding_weight": {
- "type": "u32",
+ "type": "u16",
"description": [
"Transaction weight the channel opener will pay us for a leased funding transaction."
]
@@ -15892,7 +15892,7 @@
]
},
"channel_fee_max_proportional_thousandths": {
- "type": "u32",
+ "type": "u16",
"description": [
"Maximum channel_fee_proportional_millitionths we'll charge for routing funds leased on this channel, in thousandths."
]
@@ -26074,13 +26074,13 @@
]
},
"lease_fee_basis": {
- "type": "u32",
+ "type": "u16",
"description": [
"The proportional fee in basis points (parts per 10,000) for a lease."
]
},
"funding_weight": {
- "type": "u32",
+ "type": "u16",
"description": [
"The onchain weight you'll have to pay for a lease."
]
@@ -26092,7 +26092,7 @@
]
},
"channel_fee_max_proportional_thousandths": {
- "type": "u32",
+ "type": "u16",
"description": [
"The maximum proportional routing fee this node will charge during the lease (in thousandths, not millionths like channel_update)."
]
@@ -27129,12 +27129,6 @@
"For inflight opens, the next feerate we'll use for the channel open. Omitted if *last_feerate* admits no valid next feerate, which only a channel written by an older, unbounded version can do."
]
},
- "next_fee_step": {
- "type": "u32",
- "description": [
- "For inflight opens, the next feerate step we'll use for the channel open."
- ]
- },
"inflight": {
"type": "array",
"description": [
@@ -27400,19 +27394,19 @@
]
},
"their_to_self_delay": {
- "type": "u32",
+ "type": "u16",
"description": [
"The number of blocks before they can take their funds if they unilateral close."
]
},
"our_to_self_delay": {
- "type": "u32",
+ "type": "u16",
"description": [
"The number of blocks before we can take our funds if we unilateral close."
]
},
"max_accepted_htlcs": {
- "type": "u32",
+ "type": "u16",
"description": [
"Maximum number of incoming HTLC we will accept at once."
]
### contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py
[binary or diff unavailable]
### contrib/pyln-testing/pyln/testing/grpc2py.py
@@ -1033,7 +1033,6 @@ def listpeerchannels_channels2py(m):
"min_to_us_msat": amount2msat(m.min_to_us_msat), # PrimitiveField in generate_composite
"minimum_htlc_in_msat": amount2msat(m.minimum_htlc_in_msat), # PrimitiveField in generate_composite
"minimum_htlc_out_msat": amount2msat(m.minimum_htlc_out_msat), # PrimitiveField in generate_composite
- "next_fee_step": m.next_fee_step, # PrimitiveField in generate_composite
"next_feerate": m.next_feerate, # PrimitiveField in generate_composite
"our_max_htlc_value_in_flight_msat": amount2msat(m.our_max_htlc_value_in_flight_msat), # PrimitiveField in generate_composite
"our_reserve_msat": amount2msat(m.our_reserve_msat), # PrimitiveField in generate_composite
### doc/schemas/funderupdate.json
@@ -103,14 +103,14 @@
"default": "2k sats"
},
"lease_fee_basis": {
- "type": "u32",
+ "type": "u16",
"description": [
"A basis fee that's calculated as 1/10k of the total requested funds the peer is asking for. Node will receive the total of *lease_fee_basis* times requested funds / 10k satoshis added to their channel balance, paid by the opening node."
],
"default": "0.65% (65 basis points)"
},
"funding_weight": {
- "type": "u32",
+ "type": "u16",
"description": [
"To calculate the fee the peer will compensate your node for its contributing inputs to the funding transaction. The total fee is calculated as the `open_channel2`.`funding_feerate_perkw` times this *funding_weight* divided by 1000. Node will have this funding fee added to their channel balance, paid by the opening node."
],
@@ -124,7 +124,7 @@
"default": "5k sats"
},
"channel_fee_max_proportional_thousandths": {
- "type": "u32",
+ "type": "u16",
"description": [
"A commitment to a maximum `channel_fee_proportional_millionths` that your node will charge for routing payments over this leased channel during the lease duration. Note that it's denominated in 'thousandths'. A setting of `1` is equal to 1k ppm; `5` is 5k ppm, etc."
],
@@ -232,13 +232,13 @@
]
},
"lease_fee_basis": {
- "type": "u32",
+ "type": "u16",
"description": [
"Proportional fee to charge for a channel lease, calculated as 1/10,000th of requested funds."
]
},
"funding_weight": {
- "type": "u32",
+ "type": "u16",
"description": [
"Transaction weight the channel opener will pay us for a leased funding transaction."
]
@@ -250,7 +250,7 @@
]
},
"channel_fee_max_proportional_thousandths": {
- "type": "u32",
+ "type": "u16",
"description": [
"Maximum channel_fee_proportional_millitionths we'll charge for routing funds leased on this channel, in thousandths."
]
### doc/schemas/listnodes.json
@@ -210,13 +210,13 @@
]
},
"lease_fee_basis": {
- "type": "u32",
+ "type": "u16",
"description": [
"The proportional fee in basis points (parts per 10,000) for a lease."
]
},
"funding_weight": {
- "type": "u32",
+ "type": "u16",
"description": [
"The onchain weight you'll have to pay for a lease."
]
@@ -228,7 +228,7 @@
]
},
"channel_fee_max_proportional_thousandths": {
- "type": "u32",
+ "type": "u16",
"description": [
"The maximum proportional routing fee this node will charge during the lease (in thousandths, not millionths like channel_update)."
]
### doc/schemas/listpeerchannels.json
@@ -363,12 +363,6 @@
"For inflight opens, the next feerate we'll use for the channel open. Omitted if *last_feerate* admits no valid next feerate, which only a channel written by an older, unbounded version can do."
]
},
- "next_fee_step": {
- "type": "u32",
- "description": [
- "For inflight opens, the next feerate step we'll use for the channel open."
- ]
- },
"inflight": {
"type": "array",
"description": [
@@ -634,19 +628,19 @@
]
},
"their_to_self_delay": {
- "type": "u32",
+ "type": "u16",
"description": [
"The number of blocks before they can take their funds if they unilateral close."
]
},
"our_to_self_delay": {
- "type": "u32",
+ "type": "u16",
"description": [
"The number of blocks before we can take our funds if we unilateral close."
]
},
"max_accepted_htlcs": {
- "type": "u32",
+ "type": "u16",
"description": [
"Maximum number of incoming HTLC we will accept at once."
]
### tests/test_plugin.py
@@ -4261,8 +4261,6 @@ def test_sql(node_factory, bitcoind):
'type': 'string'},
{'name': 'next_feerate',
'type': 'string'},
- {'name': 'next_fee_step',
- 'type': 'u32'},
{'name': 'close_to',
'type': 'hex'},
{'name': 'private',Why this scored 19/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.