@ -1105,6 +1105,7 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
u8 * msg = NULL ;
struct amount_sat * amount ;
struct amount_msat * push_msat ;
fc - > cmd = cmd ;
fc - > cancels = tal_arr ( fc , struct command * , 0 ) ;
@ -1119,6 +1120,7 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
p_opt ( " feerate " , param_feerate , & feerate_per_kw ) ,
p_opt_def ( " announce " , param_bool , & announce_channel , true ) ,
p_opt ( " close_to " , param_bitcoin_address , & fc - > our_upfront_shutdown_script ) ,
p_opt ( " push_msat " , param_msat , & push_msat ) ,
NULL ) )
return command_param_failed ( ) ;
} else {
@ -1132,6 +1134,7 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
p_opt ( " satoshi " , param_sat , & satoshi ) ,
p_opt ( " feerate " , param_feerate , & feerate_per_kw ) ,
p_opt_def ( " announce " , param_bool , & announce_channel , true ) ,
p_opt ( " push_msat " , param_msat , & push_msat ) ,
NULL ) )
return command_param_failed ( ) ;
@ -1153,6 +1156,13 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
type_to_string ( tmpctx , struct amount_sat ,
& chainparams - > max_funding ) ) ;
if ( push_msat & & amount_msat_greater_sat ( * push_msat , * amount ) )
return command_fail ( cmd , FUND_CANNOT_AFFORD ,
" Requested to push_msat of %s is greater than "
" available funding amount %s " ,
type_to_string ( tmpctx , struct amount_msat , push_msat ) ,
type_to_string ( tmpctx , struct amount_sat , amount ) ) ;
fc - > funding = * amount ;
if ( ! feerate_per_kw ) {
feerate_per_kw = tal ( cmd , u32 ) ;
@ -1192,8 +1202,7 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
return command_fail ( cmd , LIGHTNINGD , " Already funding channel " ) ;
}
/* FIXME: Support push_msat? */
fc - > push = AMOUNT_MSAT ( 0 ) ;
fc - > push = push_msat ? * push_msat : AMOUNT_MSAT ( 0 ) ;
fc - > channel_flags = OUR_CHANNEL_FLAGS ;
if ( ! * announce_channel ) {
fc - > channel_flags & = ~ CHANNEL_FLAGS_ANNOUNCE_CHANNEL ;