@@ -53,6 +53,8 @@ pub const LSPS5_UNKNOWN_ERROR_CODE: i32 = 1000;
53
53
pub const LSPS5_SERIALIZATION_ERROR_CODE : i32 = 1001 ;
54
54
/// A notification was sent too frequently.
55
55
pub const LSPS5_SLOW_DOWN_ERROR_CODE : i32 = 1002 ;
56
+ /// A request was rejected because the client has no prior activity with the LSP (no open channel and no active LSPS1 or LSPS2 flow). The client should first open a channel
57
+ pub const LSPS5_NO_PRIOR_ACTIVITY_ERROR_CODE : i32 = 1003 ;
56
58
57
59
pub ( crate ) const LSPS5_SET_WEBHOOK_METHOD_NAME : & str = "lsps5.set_webhook" ;
58
60
pub ( crate ) const LSPS5_LIST_WEBHOOKS_METHOD_NAME : & str = "lsps5.list_webhooks" ;
@@ -113,6 +115,10 @@ pub enum LSPS5ProtocolError {
113
115
///
114
116
/// [`NOTIFICATION_COOLDOWN_TIME`]: super::service::NOTIFICATION_COOLDOWN_TIME
115
117
SlowDownError ,
118
+
119
+ /// Request rejected because the client has no prior activity with the LSP (no open channel and no active LSPS1 or LSPS2 flow). The client should first open a channel
120
+ /// or initiate an LSPS1/LSPS2 interaction before retrying.
121
+ NoPriorActivityError ,
116
122
}
117
123
118
124
impl LSPS5ProtocolError {
@@ -129,6 +135,7 @@ impl LSPS5ProtocolError {
129
135
LSPS5ProtocolError :: UnknownError => LSPS5_UNKNOWN_ERROR_CODE ,
130
136
LSPS5ProtocolError :: SerializationError => LSPS5_SERIALIZATION_ERROR_CODE ,
131
137
LSPS5ProtocolError :: SlowDownError => LSPS5_SLOW_DOWN_ERROR_CODE ,
138
+ LSPS5ProtocolError :: NoPriorActivityError => LSPS5_NO_PRIOR_ACTIVITY_ERROR_CODE ,
132
139
}
133
140
}
134
141
/// The error message for the LSPS5 protocol error.
@@ -145,6 +152,9 @@ impl LSPS5ProtocolError {
145
152
"Error serializing LSPS5 webhook notification"
146
153
} ,
147
154
LSPS5ProtocolError :: SlowDownError => "Notification sent too frequently" ,
155
+ LSPS5ProtocolError :: NoPriorActivityError => {
156
+ "Request rejected due to no prior activity with the LSP"
157
+ } ,
148
158
}
149
159
}
150
160
}
@@ -249,6 +259,9 @@ impl From<LSPSResponseError> for LSPS5ProtocolError {
249
259
LSPS5_UNSUPPORTED_PROTOCOL_ERROR_CODE => LSPS5ProtocolError :: UnsupportedProtocol ,
250
260
LSPS5_TOO_MANY_WEBHOOKS_ERROR_CODE => LSPS5ProtocolError :: TooManyWebhooks ,
251
261
LSPS5_APP_NAME_NOT_FOUND_ERROR_CODE => LSPS5ProtocolError :: AppNameNotFound ,
262
+ LSPS5_SERIALIZATION_ERROR_CODE => LSPS5ProtocolError :: SerializationError ,
263
+ LSPS5_SLOW_DOWN_ERROR_CODE => LSPS5ProtocolError :: SlowDownError ,
264
+ LSPS5_NO_PRIOR_ACTIVITY_ERROR_CODE => LSPS5ProtocolError :: NoPriorActivityError ,
252
265
_ => LSPS5ProtocolError :: UnknownError ,
253
266
}
254
267
}
@@ -640,6 +653,12 @@ pub enum LSPS5Request {
640
653
RemoveWebhook ( RemoveWebhookRequest ) ,
641
654
}
642
655
656
+ impl LSPS5Request {
657
+ pub ( crate ) fn is_state_allocating ( & self ) -> bool {
658
+ matches ! ( self , LSPS5Request :: SetWebhook ( _) )
659
+ }
660
+ }
661
+
643
662
/// An LSPS5 protocol response.
644
663
#[ derive( Clone , Debug , PartialEq , Eq ) ]
645
664
pub enum LSPS5Response {
0 commit comments