@@ -389,6 +389,11 @@ enum Commands {
389389 push_to_counterparty : Option < Amount > ,
390390 #[ arg( long, help = "Whether the channel should be public" ) ]
391391 announce_channel : bool ,
392+ #[ arg(
393+ long,
394+ help = "Allow the counterparty to spend all its channel balance. This cannot be set together with `announce_channel`."
395+ ) ]
396+ disable_counterparty_reserve : bool ,
392397 // Channel config options
393398 #[ arg(
394399 long,
@@ -676,7 +681,7 @@ async fn main() {
676681 } ) ,
677682 ( Some ( _) , Some ( _) ) => {
678683 handle_error ( LdkServerError :: new (
679- InternalError ,
684+ InvalidRequestError ,
680685 "Only one of description or description_hash can be set." . to_string ( ) ,
681686 ) ) ;
682687 } ,
@@ -914,6 +919,7 @@ async fn main() {
914919 channel_amount,
915920 push_to_counterparty,
916921 announce_channel,
922+ disable_counterparty_reserve,
917923 forwarding_fee_proportional_millionths,
918924 forwarding_fee_base_msat,
919925 cltv_expiry_delta,
@@ -926,6 +932,12 @@ async fn main() {
926932 forwarding_fee_base_msat,
927933 cltv_expiry_delta,
928934 ) ;
935+ if announce_channel && disable_counterparty_reserve {
936+ handle_error ( LdkServerError :: new (
937+ InvalidRequestError ,
938+ "Cannot set both `announce_channel` and `disable_counterparty_reserve`" ,
939+ ) ) ;
940+ }
929941
930942 handle_response_result :: < _ , OpenChannelResponse > (
931943 client
@@ -936,6 +948,7 @@ async fn main() {
936948 push_to_counterparty_msat,
937949 channel_config,
938950 announce_channel,
951+ disable_counterparty_reserve,
939952 } )
940953 . await ,
941954 ) ;
@@ -1237,7 +1250,7 @@ fn parse_bolt11_invoice_description(
12371250 } ) ,
12381251 ( Some ( _) , Some ( _) ) => {
12391252 handle_error ( LdkServerError :: new (
1240- InternalError ,
1253+ InvalidRequestError ,
12411254 "Only one of description or description_hash can be set." . to_string ( ) ,
12421255 ) ) ;
12431256 } ,
@@ -1249,13 +1262,13 @@ fn parse_page_token(token_str: &str) -> Result<PageToken, LdkServerError> {
12491262 let parts: Vec < & str > = token_str. split ( ':' ) . collect ( ) ;
12501263 if parts. len ( ) != 2 {
12511264 return Err ( LdkServerError :: new (
1252- InternalError ,
1265+ InvalidRequestError ,
12531266 "Page token must be in format 'token:index'" . to_string ( ) ,
12541267 ) ) ;
12551268 }
1256- let index = parts[ 1 ]
1257- . parse :: < i64 > ( )
1258- . map_err ( |_| LdkServerError :: new ( InternalError , "Invalid page token index" . to_string ( ) ) ) ?;
1269+ let index = parts[ 1 ] . parse :: < i64 > ( ) . map_err ( |_| {
1270+ LdkServerError :: new ( InvalidRequestError , "Invalid page token index" . to_string ( ) )
1271+ } ) ?;
12591272 Ok ( PageToken { token : parts[ 0 ] . to_string ( ) , index } )
12601273}
12611274
0 commit comments