@@ -1661,6 +1661,31 @@ static struct command_result *param_outpoint(struct command *cmd,
1661
1661
"should be a txid:outnum" );
1662
1662
}
1663
1663
1664
+ static struct command_result * param_feerate_range (struct command * cmd ,
1665
+ const char * name ,
1666
+ const char * buffer ,
1667
+ const jsmntok_t * tok ,
1668
+ u32 * * feerate_range )
1669
+ {
1670
+ struct command_result * ret ;
1671
+ u32 * rate ;
1672
+
1673
+ * feerate_range = tal_arr (cmd , u32 , 2 );
1674
+ if (tok -> type != JSMN_ARRAY || tok -> size != 2 )
1675
+ return command_fail_badparam (cmd , name , buffer , tok ,
1676
+ "should be an array of 2 entries" );
1677
+
1678
+ ret = param_feerate (cmd , name , buffer , tok + 1 , & rate );
1679
+ if (ret )
1680
+ return ret ;
1681
+ (* feerate_range )[0 ] = * rate ;
1682
+ ret = param_feerate (cmd , name , buffer , tok + 2 , & rate );
1683
+ if (ret )
1684
+ return ret ;
1685
+ (* feerate_range )[1 ] = * rate ;
1686
+ return NULL ;
1687
+ }
1688
+
1664
1689
static struct command_result * json_close (struct command * cmd ,
1665
1690
const char * buffer ,
1666
1691
const jsmntok_t * obj UNNEEDED ,
@@ -1674,6 +1699,7 @@ static struct command_result *json_close(struct command *cmd,
1674
1699
bool close_script_set , wrong_funding_changed , * force_lease_close ;
1675
1700
const char * fee_negotiation_step_str ;
1676
1701
struct bitcoin_outpoint * wrong_funding ;
1702
+ u32 * feerate_range ;
1677
1703
char * end ;
1678
1704
bool anysegwit ;
1679
1705
@@ -1687,6 +1713,7 @@ static struct command_result *json_close(struct command *cmd,
1687
1713
p_opt ("wrong_funding" , param_outpoint , & wrong_funding ),
1688
1714
p_opt_def ("force_lease_closed" , param_bool ,
1689
1715
& force_lease_close , false),
1716
+ p_opt ("feerange" , param_feerate_range , & feerate_range ),
1690
1717
NULL ))
1691
1718
return command_param_failed ();
1692
1719
@@ -1845,6 +1872,9 @@ static struct command_result *json_close(struct command *cmd,
1845
1872
wrong_funding_changed = false;
1846
1873
}
1847
1874
1875
+ /* Works fine if feerate_range is NULL */
1876
+ channel -> closing_feerate_range = tal_steal (channel , feerate_range );
1877
+
1848
1878
/* Normal case.
1849
1879
* We allow states shutting down and sigexchange; a previous
1850
1880
* close command may have timed out, and this current command
0 commit comments