| 965 | } |
| 966 | |
| 967 | struct amount_sat change_fee(u32 feerate_perkw, size_t total_weight) |
| 968 | { |
| 969 | struct amount_sat fee; |
| 970 | |
| 971 | /* Must be able to pay for its own additional weight */ |
| 972 | /* Rounding can cause off by one errors, so we do this */ |
| 973 | if (!amount_sat_sub(&fee, |
| 974 | amount_tx_fee(feerate_perkw, change_weight() + total_weight), |
| 975 | amount_tx_fee(feerate_perkw, total_weight))) |
| 976 | abort(); |
| 977 | return fee; |
| 978 | } |
| 979 | |
| 980 | struct amount_sat change_amount(struct amount_sat excess, u32 feerate_perkw, |
| 981 | size_t total_weight) |
no test coverage detected