| 978 | } |
| 979 | |
| 980 | struct amount_sat change_amount(struct amount_sat excess, u32 feerate_perkw, |
| 981 | size_t total_weight) |
| 982 | { |
| 983 | struct amount_sat fee = change_fee(feerate_perkw, total_weight); |
| 984 | |
| 985 | if (!amount_sat_sub(&excess, excess, fee)) |
| 986 | return AMOUNT_SAT(0); |
| 987 | |
| 988 | if (chainparams->is_elements) { |
| 989 | if (!amount_sat_greater_eq(excess, AMOUNT_SAT(546))) |
| 990 | return AMOUNT_SAT(0); |
| 991 | } else { |
| 992 | if (!amount_sat_greater_eq(excess, AMOUNT_SAT(330))) |
| 993 | return AMOUNT_SAT(0); |
| 994 | } |
| 995 | |
| 996 | return excess; |
| 997 | } |
| 998 | |
| 999 | u32 tx_feerate(const struct bitcoin_tx *tx) |
| 1000 | { |
no test coverage detected