funder: subtract the fee of the utxo from the available amount

Adjust our total available funds downward, to account for the fees we'll
be charged to spend them.
This commit is contained in:
niftynei
2021-05-04 18:52:24 -05:00
committed by Rusty Russell
parent 9a1041ee97
commit f6186d5860
2 changed files with 17 additions and 7 deletions

View File

@@ -213,9 +213,6 @@ calculate_our_funding(struct funder_policy policy,
if (amount_sat_greater(our_funding, policy.per_channel_max))
our_funding = policy.per_channel_max;
/* FIXME: net_available_funds needs to know feerate, and make
* worst-case UTXO assumptions? */
/* Is our_funding more than we have available? if so
* set to max available */
if (amount_sat_greater(our_funding, net_available_funds))