@@ -42,8 +42,7 @@ use crate::lsps2::msgs::{
42
42
LSPS2_GET_INFO_REQUEST_UNRECOGNIZED_OR_STALE_TOKEN_ERROR_CODE ,
43
43
} ;
44
44
45
- /// The default value applied for [`LSPS2ServiceLimits::max_pending_requests_per_peer`].
46
- pub const DEFAULT_MAX_PENDING_REQUESTS_PER_PEER : usize = 10 ;
45
+ const MAX_PENDING_REQUESTS_PER_PEER : usize = 10 ;
47
46
48
47
/// Server-side configuration options for JIT channels.
49
48
#[ derive( Clone , Debug ) ]
@@ -52,23 +51,6 @@ pub struct LSPS2ServiceConfig {
52
51
///
53
52
/// Note: If this changes then old promises given out will be considered invalid.
54
53
pub promise_secret : [ u8 ; 32 ] ,
55
- /// Configuration limits for JIT channels.
56
- pub service_limits : LSPS2ServiceLimits ,
57
- }
58
-
59
- /// Server-side configuration limits for JIT channels.
60
- #[ derive( Clone , Debug ) ]
61
- pub struct LSPS2ServiceLimits {
62
- /// The maximum number of pending requests we allow on a per-peer basis.
63
- ///
64
- /// Any requests beyond this limit will be ignored.
65
- pub max_pending_requests_per_peer : usize ,
66
- }
67
-
68
- impl Default for LSPS2ServiceLimits {
69
- fn default ( ) -> Self {
70
- Self { max_pending_requests_per_peer : DEFAULT_MAX_PENDING_REQUESTS_PER_PEER }
71
- }
72
54
}
73
55
74
56
/// Information about the initial payment size and JIT channel opening fee.
@@ -1010,9 +992,7 @@ where
1010
992
. entry ( * counterparty_node_id)
1011
993
. or_insert ( Mutex :: new ( PeerState :: new ( ) ) ) ;
1012
994
let mut peer_state_lock = inner_state_lock. lock ( ) . unwrap ( ) ;
1013
- if peer_state_lock. pending_requests . len ( )
1014
- < self . config . service_limits . max_pending_requests_per_peer
1015
- {
995
+ if peer_state_lock. pending_requests . len ( ) < MAX_PENDING_REQUESTS_PER_PEER {
1016
996
peer_state_lock
1017
997
. pending_requests
1018
998
. insert ( request_id. clone ( ) , LSPS2Request :: GetInfo ( params. clone ( ) ) ) ;
@@ -1035,7 +1015,7 @@ where
1035
1015
1036
1016
let err = format ! (
1037
1017
"Peer {} reached maximum number of pending requests: {}" ,
1038
- counterparty_node_id, self . config . service_limits . max_pending_requests_per_peer
1018
+ counterparty_node_id, MAX_PENDING_REQUESTS_PER_PEER
1039
1019
) ;
1040
1020
1041
1021
let result =
@@ -1143,9 +1123,7 @@ where
1143
1123
. or_insert ( Mutex :: new ( PeerState :: new ( ) ) ) ;
1144
1124
let mut peer_state_lock = inner_state_lock. lock ( ) . unwrap ( ) ;
1145
1125
1146
- if peer_state_lock. pending_requests . len ( )
1147
- < self . config . service_limits . max_pending_requests_per_peer
1148
- {
1126
+ if peer_state_lock. pending_requests . len ( ) < MAX_PENDING_REQUESTS_PER_PEER {
1149
1127
peer_state_lock
1150
1128
. pending_requests
1151
1129
. insert ( request_id. clone ( ) , LSPS2Request :: Buy ( params. clone ( ) ) ) ;
@@ -1170,7 +1148,7 @@ where
1170
1148
1171
1149
let err = format ! (
1172
1150
"Peer {} reached maximum number of pending requests: {}" ,
1173
- counterparty_node_id, self . config . service_limits . max_pending_requests_per_peer
1151
+ counterparty_node_id, MAX_PENDING_REQUESTS_PER_PEER
1174
1152
) ;
1175
1153
let result =
1176
1154
Err ( LightningError { err, action : ErrorAction :: IgnoreAndLog ( Level :: Debug ) } ) ;
0 commit comments