@@ -410,13 +410,6 @@ impl Channel {
410
410
1000 // TODO
411
411
}
412
412
413
- fn derive_minimum_depth ( _channel_value_satoshis_msat : u64 , _value_to_self_msat : u64 ) -> u32 {
414
- // Note that in order to comply with BOLT 7 announcement_signatures requirements this must
415
- // be at least 6.
416
- const CONF_TARGET : u32 = 12 ; //TODO: Should be much higher
417
- CONF_TARGET
418
- }
419
-
420
413
// Constructors:
421
414
pub fn new_outbound ( fee_estimator : & FeeEstimator , keys_provider : & Arc < KeysInterface > , their_node_id : PublicKey , channel_value_satoshis : u64 , push_msat : u64 , user_id : u64 , logger : Arc < Logger > , config : & UserConfig ) -> Result < Channel , APIError > {
422
415
let chan_keys = keys_provider. get_channel_keys ( false ) ;
@@ -565,32 +558,32 @@ impl Channel {
565
558
}
566
559
567
560
// Now check against optional parameters as set by config...
568
- if msg. funding_satoshis < config. channel_limits . min_funding_satoshis {
561
+ if msg. funding_satoshis < config. peer_channel_config_limits . min_funding_satoshis {
569
562
return Err ( ChannelError :: Close ( "funding satoshis is less than the user specified limit" ) ) ;
570
563
}
571
- if msg. htlc_minimum_msat > config. channel_limits . max_htlc_minimum_msat {
564
+ if msg. htlc_minimum_msat > config. peer_channel_config_limits . max_htlc_minimum_msat {
572
565
return Err ( ChannelError :: Close ( "htlc minimum msat is higher than the user specified limit" ) ) ;
573
566
}
574
- if msg. max_htlc_value_in_flight_msat < config. channel_limits . min_max_htlc_value_in_flight_msat {
567
+ if msg. max_htlc_value_in_flight_msat < config. peer_channel_config_limits . min_max_htlc_value_in_flight_msat {
575
568
return Err ( ChannelError :: Close ( "max htlc value in flight msat is less than the user specified limit" ) ) ;
576
569
}
577
- if msg. channel_reserve_satoshis > config. channel_limits . max_channel_reserve_satoshis {
570
+ if msg. channel_reserve_satoshis > config. peer_channel_config_limits . max_channel_reserve_satoshis {
578
571
return Err ( ChannelError :: Close ( "channel reserve satoshis is higher than the user specified limit" ) ) ;
579
572
}
580
- if msg. max_accepted_htlcs < config. channel_limits . min_max_accepted_htlcs {
573
+ if msg. max_accepted_htlcs < config. peer_channel_config_limits . min_max_accepted_htlcs {
581
574
return Err ( ChannelError :: Close ( "max accepted htlcs is less than the user specified limit" ) ) ;
582
575
}
583
- if msg. dust_limit_satoshis < config. channel_limits . min_dust_limit_satoshis {
576
+ if msg. dust_limit_satoshis < config. peer_channel_config_limits . min_dust_limit_satoshis {
584
577
return Err ( ChannelError :: Close ( "dust limit satoshis is less than the user specified limit" ) ) ;
585
578
}
586
- if msg. dust_limit_satoshis > config. channel_limits . max_dust_limit_satoshis {
579
+ if msg. dust_limit_satoshis > config. peer_channel_config_limits . max_dust_limit_satoshis {
587
580
return Err ( ChannelError :: Close ( "dust limit satoshis is greater than the user specified limit" ) ) ;
588
581
}
589
582
590
583
// Convert things into internal flags and prep our state:
591
584
592
585
let their_announce = if ( msg. channel_flags & 1 ) == 1 { true } else { false } ;
593
- if config. channel_limits . force_announced_channel_preference {
586
+ if config. peer_channel_config_limits . force_announced_channel_preference {
594
587
if local_config. announced_channel != their_announce {
595
588
return Err ( ChannelError :: Close ( "Peer tried to open channel but their announcement preference is different from ours" ) ) ;
596
589
}
@@ -687,7 +680,7 @@ impl Channel {
687
680
our_htlc_minimum_msat : Channel :: derive_our_htlc_minimum_msat ( msg. feerate_per_kw as u64 ) ,
688
681
their_to_self_delay : msg. to_self_delay ,
689
682
their_max_accepted_htlcs : msg. max_accepted_htlcs ,
690
- minimum_depth : Channel :: derive_minimum_depth ( msg . funding_satoshis * 1000 , msg . push_msat ) ,
683
+ minimum_depth : config . own_channel_config . minimum_depth ,
691
684
692
685
their_funding_pubkey : Some ( msg. funding_pubkey ) ,
693
686
their_revocation_basepoint : Some ( msg. revocation_basepoint ) ,
@@ -1383,25 +1376,25 @@ impl Channel {
1383
1376
}
1384
1377
1385
1378
// Now check against optional parameters as set by config...
1386
- if msg. htlc_minimum_msat > config. channel_limits . max_htlc_minimum_msat {
1379
+ if msg. htlc_minimum_msat > config. peer_channel_config_limits . max_htlc_minimum_msat {
1387
1380
return Err ( ChannelError :: Close ( "htlc minimum msat is higher than the user specified limit" ) ) ;
1388
1381
}
1389
- if msg. max_htlc_value_in_flight_msat < config. channel_limits . min_max_htlc_value_in_flight_msat {
1382
+ if msg. max_htlc_value_in_flight_msat < config. peer_channel_config_limits . min_max_htlc_value_in_flight_msat {
1390
1383
return Err ( ChannelError :: Close ( "max htlc value in flight msat is less than the user specified limit" ) ) ;
1391
1384
}
1392
- if msg. channel_reserve_satoshis > config. channel_limits . max_channel_reserve_satoshis {
1385
+ if msg. channel_reserve_satoshis > config. peer_channel_config_limits . max_channel_reserve_satoshis {
1393
1386
return Err ( ChannelError :: Close ( "channel reserve satoshis is higher than the user specified limit" ) ) ;
1394
1387
}
1395
- if msg. max_accepted_htlcs < config. channel_limits . min_max_accepted_htlcs {
1388
+ if msg. max_accepted_htlcs < config. peer_channel_config_limits . min_max_accepted_htlcs {
1396
1389
return Err ( ChannelError :: Close ( "max accepted htlcs is less than the user specified limit" ) ) ;
1397
1390
}
1398
- if msg. dust_limit_satoshis < config. channel_limits . min_dust_limit_satoshis {
1391
+ if msg. dust_limit_satoshis < config. peer_channel_config_limits . min_dust_limit_satoshis {
1399
1392
return Err ( ChannelError :: Close ( "dust limit satoshis is less than the user specified limit" ) ) ;
1400
1393
}
1401
- if msg. dust_limit_satoshis > config. channel_limits . max_dust_limit_satoshis {
1394
+ if msg. dust_limit_satoshis > config. peer_channel_config_limits . max_dust_limit_satoshis {
1402
1395
return Err ( ChannelError :: Close ( "dust limit satoshis is greater than the user specified limit" ) ) ;
1403
1396
}
1404
- if msg. minimum_depth > config. channel_limits . max_minimum_depth {
1397
+ if msg. minimum_depth > config. peer_channel_config_limits . max_minimum_depth {
1405
1398
return Err ( ChannelError :: Close ( "We consider the minimum depth to be unreasonably large" ) ) ;
1406
1399
}
1407
1400
0 commit comments