mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
change fees: more accurate rounding for change amount
We were getting off-by-one for the total amount that the change is for, since it rounds the fee *down*, independent of the total weight of the entire tx. We fix this by using the diff btw the fee of the total weight (w/ and w/o the change output)
This commit is contained in:
@@ -474,7 +474,8 @@ mw_after_fundpsbt(struct command *cmd,
|
||||
}
|
||||
|
||||
/* Handle any change output. */
|
||||
mw->change_amount = change_amount(excess_sat, feerate_per_kw);
|
||||
mw->change_amount = change_amount(excess_sat, feerate_per_kw,
|
||||
estimated_final_weight);
|
||||
mw->change_needed = !amount_sat_eq(mw->change_amount, AMOUNT_SAT(0));
|
||||
|
||||
if (mw->change_needed)
|
||||
|
||||
Reference in New Issue
Block a user