Skip to content

Commit bc1d1a8

Browse files
committed
Small fix for capitalization typo.
1 parent 808e283 commit bc1d1a8

File tree

4 files changed

+43
-44
lines changed

4 files changed

+43
-44
lines changed

lightning/src/ln/channel.rs

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ macro_rules! secp_check {
434434
};
435435
}
436436

437-
438437
impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
439438
// Convert constants + channel value to limits:
440439
fn get_our_max_htlc_value_in_flight_msat(channel_value_satoshis: u64) -> u64 {
@@ -466,7 +465,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
466465
}
467466
let channel_value_msat = channel_value_satoshis * 1000;
468467
if push_msat > channel_value_msat {
469-
return Err(APIError::APIMisuseError { err: format!("push value ({}) was larger than channel_value ({})", push_msat, channel_value_msat) });
468+
return Err(APIError::APIMisuseError { err: format!("Push value ({}) was larger than channel_value ({})", push_msat, channel_value_msat) });
470469
}
471470
if config.own_channel_config.our_to_self_delay < BREAKDOWN_TIMEOUT {
472471
return Err(APIError::APIMisuseError {err: format!("Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks", config.own_channel_config.our_to_self_delay)});
@@ -560,11 +559,11 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
560559
{
561560
let lower_limit = fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::Background);
562561
if feerate_per_kw < lower_limit {
563-
return Err(ChannelError::Close(format!("Peer's feerate much too low. actual: {}. our expected lower_limit: {}", feerate_per_kw, lower_limit)));
562+
return Err(ChannelError::Close(format!("Peer's feerate much too low. Actual: {}. Our expected lower limit: {}", feerate_per_kw, lower_limit)));
564563
}
565564
let upper_limit = fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::HighPriority) as u64 * 2;
566565
if feerate_per_kw as u64 > upper_limit {
567-
return Err(ChannelError::Close(format!("Peer's feerate much too high. actual: {}. our expected upper limit {}", feerate_per_kw, upper_limit)));
566+
return Err(ChannelError::Close(format!("Peer's feerate much too high. Actual: {}. Our expected upper limit: {}", feerate_per_kw, upper_limit)));
568567
}
569568
Ok(())
570569
}
@@ -587,15 +586,15 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
587586
let mut local_config = (*config).channel_options.clone();
588587

589588
if config.own_channel_config.our_to_self_delay < BREAKDOWN_TIMEOUT {
590-
return Err(ChannelError::Close(format!("Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks", config.own_channel_config.our_to_self_delay)));
589+
return Err(ChannelError::Close(format!("Configured with an unreasonable our_to_self_delay ({}) putting user funds at risks. It must be lower than {}", config.own_channel_config.our_to_self_delay, BREAKDOWN_TIMEOUT)));
591590
}
592591

593592
// Check sanity of message fields:
594593
if msg.funding_satoshis >= MAX_FUNDING_SATOSHIS {
595-
return Err(ChannelError::Close(format!("funding must be smaller than {}. It was {}", msg.funding_satoshis, MAX_FUNDING_SATOSHIS)));
594+
return Err(ChannelError::Close(format!("Funding must be smaller than {}. It was {}", msg.funding_satoshis, MAX_FUNDING_SATOSHIS)));
596595
}
597596
if msg.channel_reserve_satoshis > msg.funding_satoshis {
598-
return Err(ChannelError::Close(format!("Bogus channel_reserve_satoshis({}). must be not greater than funding_satoshis: {}", msg.channel_reserve_satoshis, msg.funding_satoshis)));
597+
return Err(ChannelError::Close(format!("Bogus channel_reserve_satoshis ({}). Must be not greater than funding_satoshis: {}", msg.channel_reserve_satoshis, msg.funding_satoshis)));
599598
}
600599
let funding_value = (msg.funding_satoshis - msg.channel_reserve_satoshis) * 1000;
601600
if msg.push_msat > funding_value {
@@ -605,46 +604,46 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
605604
return Err(ChannelError::Close(format!("dust_limit_satoshis {} was larger than funding_satoshis {}. Peer never wants payout outputs?", msg.dust_limit_satoshis, msg.funding_satoshis)));
606605
}
607606
if msg.dust_limit_satoshis > msg.channel_reserve_satoshis {
608-
return Err(ChannelError::Close(format!("Bogus; channel reserve({}) is less than dust limit ({})", msg.channel_reserve_satoshis, msg.dust_limit_satoshis)));
607+
return Err(ChannelError::Close(format!("Bogus; channel reserve ({}) is less than dust limit ({})", msg.channel_reserve_satoshis, msg.dust_limit_satoshis)));
609608
}
610609
let full_channel_value_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis) * 1000;
611610
if msg.htlc_minimum_msat >= full_channel_value_msat {
612-
return Err(ChannelError::Close(format!("Minimum htlc value ({}) is full channel value ({})", msg.htlc_minimum_msat, full_channel_value_msat)));
611+
return Err(ChannelError::Close(format!("Minimum htlc value ({}) was larger than full channel value ({})", msg.htlc_minimum_msat, full_channel_value_msat)));
613612
}
614613
Channel::<ChanSigner>::check_remote_fee(fee_estimator, msg.feerate_per_kw)?;
615614

616615
let max_to_self_delay = u16::min(config.peer_channel_config_limits.their_to_self_delay, MAX_LOCAL_BREAKDOWN_TIMEOUT);
617616
if msg.to_self_delay > max_to_self_delay {
618-
return Err(ChannelError::Close(format!("They wanted our payments to be delayed by a needlessly long period. upper limit: {}. actual: {}", max_to_self_delay, msg.to_self_delay)));
617+
return Err(ChannelError::Close(format!("They wanted our payments to be delayed by a needlessly long period. Upper limit: {}. Actual: {}", max_to_self_delay, msg.to_self_delay)));
619618
}
620619
if msg.max_accepted_htlcs < 1 {
621-
return Err(ChannelError::Close("0 max_accpted_htlcs makes for a useless channel".to_owned()));
620+
return Err(ChannelError::Close("0 max_accepted_htlcs makes for a useless channel".to_owned()));
622621
}
623622
if msg.max_accepted_htlcs > 483 {
624-
return Err(ChannelError::Close(format!("max_accpted_htlcs was {}. it must not be larger than 483", msg.max_accepted_htlcs)));
623+
return Err(ChannelError::Close(format!("max_accepted_htlcs was {}. It must not be larger than 483", msg.max_accepted_htlcs)));
625624
}
626625

627626
// Now check against optional parameters as set by config...
628627
if msg.funding_satoshis < config.peer_channel_config_limits.min_funding_satoshis {
629-
return Err(ChannelError::Close(format!("funding satoshis ({}) is less than the user specified limit ({})", msg.funding_satoshis, config.peer_channel_config_limits.min_funding_satoshis)));
628+
return Err(ChannelError::Close(format!("Funding satoshis ({}) is less than the user specified limit ({})", msg.funding_satoshis, config.peer_channel_config_limits.min_funding_satoshis)));
630629
}
631630
if msg.htlc_minimum_msat > config.peer_channel_config_limits.max_htlc_minimum_msat {
632-
return Err(ChannelError::Close(format!("htlc minimum msat ({}) is higher than the user specified limit ({})", msg.htlc_minimum_msat, config.peer_channel_config_limits.max_htlc_minimum_msat)));
631+
return Err(ChannelError::Close(format!("htlc_minimum_msat ({}) is higher than the user specified limit ({})", msg.htlc_minimum_msat, config.peer_channel_config_limits.max_htlc_minimum_msat)));
633632
}
634633
if msg.max_htlc_value_in_flight_msat < config.peer_channel_config_limits.min_max_htlc_value_in_flight_msat {
635-
return Err(ChannelError::Close(format!("max htlc value in flight msat ({}) is less than the user specified limit ({})", msg.max_htlc_value_in_flight_msat, config.peer_channel_config_limits.min_max_htlc_value_in_flight_msat)));
634+
return Err(ChannelError::Close(format!("max_htlc_value_in_flight_msat ({}) is less than the user specified limit ({})", msg.max_htlc_value_in_flight_msat, config.peer_channel_config_limits.min_max_htlc_value_in_flight_msat)));
636635
}
637636
if msg.channel_reserve_satoshis > config.peer_channel_config_limits.max_channel_reserve_satoshis {
638-
return Err(ChannelError::Close(format!("channel reserve satoshis ({}) is higher than the user specified limit ({})", msg.channel_reserve_satoshis, config.peer_channel_config_limits.max_channel_reserve_satoshis)));
637+
return Err(ChannelError::Close(format!("channel_reserve_satoshis ({}) is higher than the user specified limit ({})", msg.channel_reserve_satoshis, config.peer_channel_config_limits.max_channel_reserve_satoshis)));
639638
}
640639
if msg.max_accepted_htlcs < config.peer_channel_config_limits.min_max_accepted_htlcs {
641-
return Err(ChannelError::Close(format!("max accepted htlcs ({}) is less than the user specified limit ({})", msg.max_accepted_htlcs, config.peer_channel_config_limits.min_max_accepted_htlcs)));
640+
return Err(ChannelError::Close(format!("max_accepted_htlcs ({}) is less than the user specified limit ({})", msg.max_accepted_htlcs, config.peer_channel_config_limits.min_max_accepted_htlcs)));
642641
}
643642
if msg.dust_limit_satoshis < config.peer_channel_config_limits.min_dust_limit_satoshis {
644-
return Err(ChannelError::Close(format!("dust limit satoshis ({}) is less than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.min_dust_limit_satoshis)));
643+
return Err(ChannelError::Close(format!("dust_limit_satoshis ({}) is less than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.min_dust_limit_satoshis)));
645644
}
646645
if msg.dust_limit_satoshis > config.peer_channel_config_limits.max_dust_limit_satoshis {
647-
return Err(ChannelError::Close(format!("dust limit satoshis ({}) is greater than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.max_dust_limit_satoshis)));
646+
return Err(ChannelError::Close(format!("dust_limit_satoshis ({}) is greater than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.max_dust_limit_satoshis)));
648647
}
649648

650649
// Convert things into internal flags and prep our state:
@@ -663,7 +662,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
663662
let our_dust_limit_satoshis = Channel::<ChanSigner>::derive_our_dust_limit_satoshis(background_feerate);
664663
let remote_channel_reserve_satoshis = Channel::<ChanSigner>::get_remote_channel_reserve_satoshis(msg.funding_satoshis);
665664
if remote_channel_reserve_satoshis < our_dust_limit_satoshis {
666-
return Err(ChannelError::Close(format!("Suitable channel reserve not found. remote_channel_reserve was ({}). our_dusts_limit_satoshis is ({}) .aborting", remote_channel_reserve_satoshis, our_dust_limit_satoshis)));
665+
return Err(ChannelError::Close(format!("Suitable channel reserve not found. remote_channel_reserve was ({}). our_dust_limit_satoshis is ({}).", remote_channel_reserve_satoshis, our_dust_limit_satoshis)));
667666
}
668667
if msg.channel_reserve_satoshis < our_dust_limit_satoshis {
669668
return Err(ChannelError::Close(format!("channel_reserve_satoshis ({}) is small than our dust limit ({})", msg.channel_reserve_satoshis, our_dust_limit_satoshis)));
@@ -677,7 +676,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
677676
let funders_amount_msat = msg.funding_satoshis * 1000 - msg.push_msat;
678677
let lower_limit = background_feerate as u64 * COMMITMENT_TX_BASE_WEIGHT;
679678
if funders_amount_msat < lower_limit {
680-
return Err(ChannelError::Close(format!("Insufficient funding amount ({}) for initial commitment. must be at least ({})", funders_amount_msat, lower_limit)));
679+
return Err(ChannelError::Close(format!("Insufficient funding amount ({}) for initial commitment. Must be at least {}", funders_amount_msat, lower_limit)));
681680
}
682681

683682
let to_local_msat = msg.push_msat;
@@ -1378,10 +1377,10 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
13781377
return Err(ChannelError::Close(format!("Peer never wants payout outputs? dust_limit_satoshis was {}", msg.dust_limit_satoshis)));
13791378
}
13801379
if msg.channel_reserve_satoshis > self.channel_value_satoshis {
1381-
return Err(ChannelError::Close(format!("Bogus channel_reserve_satoshis({}). must not be greater than ({})", msg.channel_reserve_satoshis, self.channel_value_satoshis)));
1380+
return Err(ChannelError::Close(format!("Bogus channel_reserve_satoshis ({}). Must not be greater than ({})", msg.channel_reserve_satoshis, self.channel_value_satoshis)));
13821381
}
13831382
if msg.dust_limit_satoshis > msg.channel_reserve_satoshis {
1384-
return Err(ChannelError::Close(format!("Bogus channel_reserve({}) and dust_limit ({})", msg.dust_limit_satoshis, msg.channel_reserve_satoshis)));
1383+
return Err(ChannelError::Close(format!("Bogus channel_reserve ({}) and dust_limit ({})", msg.dust_limit_satoshis, msg.channel_reserve_satoshis)));
13851384
}
13861385
if msg.channel_reserve_satoshis < self.our_dust_limit_satoshis {
13871386
return Err(ChannelError::Close(format!("Peer never wants payout outputs? channel_reserve_satoshis was ({}). our_dust_limit is ({})", msg.channel_reserve_satoshis, self.our_dust_limit_satoshis)));
@@ -1392,40 +1391,40 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
13921391
}
13931392
let full_channel_value_msat = (self.channel_value_satoshis - msg.channel_reserve_satoshis) * 1000;
13941393
if msg.htlc_minimum_msat >= full_channel_value_msat {
1395-
return Err(ChannelError::Close(format!("Minimum htlc value({}) is full channel value ({})", msg.htlc_minimum_msat, full_channel_value_msat)));
1394+
return Err(ChannelError::Close(format!("Minimum htlc value ({}) is full channel value ({})", msg.htlc_minimum_msat, full_channel_value_msat)));
13961395
}
13971396
let max_delay_acceptable = u16::min(config.peer_channel_config_limits.their_to_self_delay, MAX_LOCAL_BREAKDOWN_TIMEOUT);
13981397
if msg.to_self_delay > max_delay_acceptable {
1399-
return Err(ChannelError::Close(format!("They wanted our payments to be delayed by a needlessly long period. upper limit: {}. actual: {}", msg.to_self_delay, max_delay_acceptable)));
1398+
return Err(ChannelError::Close(format!("They wanted our payments to be delayed by a needlessly long period. Upper limit: {}. Actual: {}", msg.to_self_delay, max_delay_acceptable)));
14001399
}
14011400
if msg.max_accepted_htlcs < 1 {
14021401
return Err(ChannelError::Close("0 max_accepted_htlcs makes for a useless channel".to_owned()));
14031402
}
14041403
if msg.max_accepted_htlcs > 483 {
1405-
return Err(ChannelError::Close(format!("max_accepted_htlcs was {} it must not be larger than 483", msg.max_accepted_htlcs)));
1404+
return Err(ChannelError::Close(format!("max_accepted_htlcs was {}. It must not be larger than 483", msg.max_accepted_htlcs)));
14061405
}
14071406

14081407
// Now check against optional parameters as set by config...
14091408
if msg.htlc_minimum_msat > config.peer_channel_config_limits.max_htlc_minimum_msat {
1410-
return Err(ChannelError::Close(format!("htlc minimum msat ({}) is higher than the user specified limit ({})", msg.htlc_minimum_msat, config.peer_channel_config_limits.max_htlc_minimum_msat)));
1409+
return Err(ChannelError::Close(format!("htlc_minimum_msat ({}) is higher than the user specified limit ({})", msg.htlc_minimum_msat, config.peer_channel_config_limits.max_htlc_minimum_msat)));
14111410
}
14121411
if msg.max_htlc_value_in_flight_msat < config.peer_channel_config_limits.min_max_htlc_value_in_flight_msat {
1413-
return Err(ChannelError::Close(format!("max htlc value in flight msat ({}) is less than the user specified limit ({})", msg.max_htlc_value_in_flight_msat, config.peer_channel_config_limits.min_max_htlc_value_in_flight_msat)));
1412+
return Err(ChannelError::Close(format!("max_htlc_value_in_flight_msat ({}) is less than the user specified limit ({})", msg.max_htlc_value_in_flight_msat, config.peer_channel_config_limits.min_max_htlc_value_in_flight_msat)));
14141413
}
14151414
if msg.channel_reserve_satoshis > config.peer_channel_config_limits.max_channel_reserve_satoshis {
1416-
return Err(ChannelError::Close(format!("channel reserve satoshis ({}) is higher than the user specified limit ({})", msg.channel_reserve_satoshis, config.peer_channel_config_limits.max_channel_reserve_satoshis)));
1415+
return Err(ChannelError::Close(format!("channel_reserve_satoshis ({}) is higher than the user specified limit ({})", msg.channel_reserve_satoshis, config.peer_channel_config_limits.max_channel_reserve_satoshis)));
14171416
}
14181417
if msg.max_accepted_htlcs < config.peer_channel_config_limits.min_max_accepted_htlcs {
1419-
return Err(ChannelError::Close(format!("max accepted htlcs ({}) is less than the user specified limit ({})", msg.max_accepted_htlcs, config.peer_channel_config_limits.min_max_accepted_htlcs)));
1418+
return Err(ChannelError::Close(format!("max_accepted_htlcs ({}) is less than the user specified limit ({})", msg.max_accepted_htlcs, config.peer_channel_config_limits.min_max_accepted_htlcs)));
14201419
}
14211420
if msg.dust_limit_satoshis < config.peer_channel_config_limits.min_dust_limit_satoshis {
1422-
return Err(ChannelError::Close(format!("dust limit satoshis ({}) is less than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.min_dust_limit_satoshis)));
1421+
return Err(ChannelError::Close(format!("dust_limit_satoshis ({}) is less than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.min_dust_limit_satoshis)));
14231422
}
14241423
if msg.dust_limit_satoshis > config.peer_channel_config_limits.max_dust_limit_satoshis {
1425-
return Err(ChannelError::Close(format!("dust limit satoshis ({}) is greater than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.max_dust_limit_satoshis)));
1424+
return Err(ChannelError::Close(format!("dust_limit_satoshis ({}) is greater than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.max_dust_limit_satoshis)));
14261425
}
14271426
if msg.minimum_depth > config.peer_channel_config_limits.max_minimum_depth {
1428-
return Err(ChannelError::Close(format!("We consider the minimum depth to be unreasonably large. expected minimum: ({}). actual: ({})", msg.minimum_depth, config.peer_channel_config_limits.max_minimum_depth)));
1427+
return Err(ChannelError::Close(format!("We consider the minimum depth to be unreasonably large. Expected minimum: ({}). Actual: ({})", msg.minimum_depth, config.peer_channel_config_limits.max_minimum_depth)));
14291428
}
14301429

14311430
let their_shutdown_scriptpubkey = if their_features.supports_upfront_shutdown_script() {
@@ -3719,7 +3718,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
37193718

37203719
let pending_value_to_self_msat = self.value_to_self_msat - htlc_outbound_value_msat;
37213720
if pending_value_to_self_msat < amount_msat {
3722-
return Err(ChannelError::Ignore(format!("Cannot send value that would overdraw remaining funds. amount: {}, pending value to self {}", amount_msat, pending_value_to_self_msat)));
3721+
return Err(ChannelError::Ignore(format!("Cannot send value that would overdraw remaining funds. Amount: {}, pending value to self {}", amount_msat, pending_value_to_self_msat)));
37233722
}
37243723

37253724
// The `+1` is for the HTLC currently being added to the commitment tx and
@@ -3728,7 +3727,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
37283727
2 * self.next_local_commit_tx_fee_msat(1 + 1)
37293728
} else { 0 };
37303729
if pending_value_to_self_msat - amount_msat < local_commit_tx_fee_msat {
3731-
return Err(ChannelError::Ignore(format!("Cannot send value that would not leave enough to pay for fees. pending value to self: {}. local_commit_tx_fee {}", pending_value_to_self_msat, local_commit_tx_fee_msat)));
3730+
return Err(ChannelError::Ignore(format!("Cannot send value that would not leave enough to pay for fees. Pending value to self: {}. local_commit_tx_fee {}", pending_value_to_self_msat, local_commit_tx_fee_msat)));
37323731
}
37333732

37343733
// Check self.local_channel_reserve_satoshis (the amount we must keep as

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
758758
/// greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
759759
pub fn create_channel(&self, their_network_key: PublicKey, channel_value_satoshis: u64, push_msat: u64, user_id: u64, override_config: Option<UserConfig>) -> Result<(), APIError> {
760760
if channel_value_satoshis < 1000 {
761-
return Err(APIError::APIMisuseError { err: format!("channel_value must be at least 1000 satoshis. it was {}", channel_value_satoshis) });
761+
return Err(APIError::APIMisuseError { err: format!("Channel value must be at least 1000 satoshis. It was {}", channel_value_satoshis) });
762762
}
763763

764764
let config = if override_config.is_some() { override_config.as_ref().unwrap() } else { &self.default_configuration };

0 commit comments

Comments
 (0)