@@ -1648,6 +1648,31 @@ static struct command_result *param_outpoint(struct command *cmd,
1648
1648
"should be a txid:outnum" );
1649
1649
}
1650
1650
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
+
1651
1676
static struct command_result * json_close (struct command * cmd ,
1652
1677
const char * buffer ,
1653
1678
const jsmntok_t * obj UNNEEDED ,
@@ -1661,6 +1686,7 @@ static struct command_result *json_close(struct command *cmd,
1661
1686
bool close_script_set , wrong_funding_changed ;
1662
1687
const char * fee_negotiation_step_str ;
1663
1688
struct bitcoin_outpoint * wrong_funding ;
1689
+ u32 * feerate_range ;
1664
1690
char * end ;
1665
1691
bool anysegwit ;
1666
1692
@@ -1672,6 +1698,7 @@ static struct command_result *json_close(struct command *cmd,
1672
1698
p_opt ("fee_negotiation_step" , param_string ,
1673
1699
& fee_negotiation_step_str ),
1674
1700
p_opt ("wrong_funding" , param_outpoint , & wrong_funding ),
1701
+ p_opt ("feerange" , param_feerate_range , & feerate_range ),
1675
1702
NULL ))
1676
1703
return command_param_failed ();
1677
1704
@@ -1821,6 +1848,9 @@ static struct command_result *json_close(struct command *cmd,
1821
1848
wrong_funding_changed = false;
1822
1849
}
1823
1850
1851
+ /* Works fine if feerate_range is NULL */
1852
+ channel -> closing_feerate_range = tal_steal (channel , feerate_range );
1853
+
1824
1854
/* Normal case.
1825
1855
* We allow states shutting down and sigexchange; a previous
1826
1856
* close command may have timed out, and this current command
0 commit comments