| 696 | } |
| 697 | |
| 698 | struct amount_sat amount_tx_fee(u32 fee_per_kw, size_t weight) |
| 699 | { |
| 700 | struct amount_sat fee; |
| 701 | |
| 702 | /* If this overflows, weight must be > 2^32, which is not a real tx */ |
| 703 | assert(!mul_overflows_u64(fee_per_kw, weight)); |
| 704 | fee.satoshis = (u64)fee_per_kw * weight / 1000; |
| 705 | |
| 706 | return fee; |
| 707 | } |
| 708 | |
| 709 | bool amount_feerate(u32 *feerate, struct amount_sat fee, size_t weight) |
| 710 | { |
no test coverage detected