@@ -1648,6 +1648,31 @@ static struct command_result *param_outpoint(struct command *cmd,
16481648 "should be a txid:outnum" );
16491649}
16501650
1651+ static struct command_result * param_feerate_range (struct command * cmd ,
1652+ const char * name ,
1653+ const char * buffer ,
1654+ const jsmntok_t * tok ,
1655+ u32 * * feerate_range )
1656+ {
1657+ struct command_result * ret ;
1658+ u32 * rate ;
1659+
1660+ * feerate_range = tal_arr (cmd , u32 , 2 );
1661+ if (tok -> type != JSMN_ARRAY || tok -> size != 2 )
1662+ return command_fail_badparam (cmd , name , buffer , tok ,
1663+ "should be an array of 2 entries" );
1664+
1665+ ret = param_feerate (cmd , name , buffer , tok + 1 , & rate );
1666+ if (ret )
1667+ return ret ;
1668+ (* feerate_range )[0 ] = * rate ;
1669+ ret = param_feerate (cmd , name , buffer , tok + 2 , & rate );
1670+ if (ret )
1671+ return ret ;
1672+ (* feerate_range )[1 ] = * rate ;
1673+ return NULL ;
1674+ }
1675+
16511676static struct command_result * json_close (struct command * cmd ,
16521677 const char * buffer ,
16531678 const jsmntok_t * obj UNNEEDED ,
@@ -1661,6 +1686,7 @@ static struct command_result *json_close(struct command *cmd,
16611686 bool close_script_set , wrong_funding_changed ;
16621687 const char * fee_negotiation_step_str ;
16631688 struct bitcoin_outpoint * wrong_funding ;
1689+ u32 * feerate_range ;
16641690 char * end ;
16651691 bool anysegwit ;
16661692
@@ -1672,6 +1698,7 @@ static struct command_result *json_close(struct command *cmd,
16721698 p_opt ("fee_negotiation_step" , param_string ,
16731699 & fee_negotiation_step_str ),
16741700 p_opt ("wrong_funding" , param_outpoint , & wrong_funding ),
1701+ p_opt ("feerange" , param_feerate_range , & feerate_range ),
16751702 NULL ))
16761703 return command_param_failed ();
16771704
@@ -1821,6 +1848,9 @@ static struct command_result *json_close(struct command *cmd,
18211848 wrong_funding_changed = false;
18221849 }
18231850
1851+ /* Works fine if feerate_range is NULL */
1852+ channel -> closing_feerate_range = tal_steal (channel , feerate_range );
1853+
18241854 /* Normal case.
18251855 * We allow states shutting down and sigexchange; a previous
18261856 * close command may have timed out, and this current command
0 commit comments