You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define a method for determining the max HTLCs rather than a const
Once we support zero-fee commitment transactions, we will no longer
have a constant number of maximum HTLCs in-flight per channel but
rather it will depend on the channel type.
Here we prepare for this by removing the `MAX_HTLCS` constant and
replacing it with a function.
return Err(ChannelError::close("0 max_accepted_htlcs makes for a useless channel".to_owned()));
2459
2459
}
2460
-
if open_channel_fields.max_accepted_htlcs > MAX_HTLCS {
2461
-
return Err(ChannelError::close(format!("max_accepted_htlcs was {}. It must not be larger than {}", open_channel_fields.max_accepted_htlcs, MAX_HTLCS)));
2460
+
if open_channel_fields.max_accepted_htlcs > max_htlcs(&channel_type) {
2461
+
return Err(ChannelError::close(format!("max_accepted_htlcs was {}. It must not be larger than {}", open_channel_fields.max_accepted_htlcs, max_htlcs(&channel_type))));
2462
2462
}
2463
2463
2464
2464
// Now check against optional parameters as set by config...
return Err(ChannelError::close("0 max_accepted_htlcs makes for a useless channel".to_owned()));
3209
3225
}
3210
-
if common_fields.max_accepted_htlcs > MAX_HTLCS {
3211
-
return Err(ChannelError::close(format!("max_accepted_htlcs was {}. It must not be larger than {}", common_fields.max_accepted_htlcs, MAX_HTLCS)));
3226
+
3227
+
let channel_type = &funding.channel_transaction_parameters.channel_type_features;
3228
+
if common_fields.max_accepted_htlcs > max_htlcs(channel_type) {
3229
+
return Err(ChannelError::close(format!("max_accepted_htlcs was {}. It must not be larger than {}", common_fields.max_accepted_htlcs, max_htlcs(channel_type))));
3212
3230
}
3213
3231
3214
3232
// Now check against optional parameters as set by config...
0 commit comments