| 13 | struct ripemd160; |
| 14 | |
| 15 | static inline struct amount_sat htlc_timeout_fee(u32 feerate_per_kw, |
| 16 | bool option_anchor_outputs, |
| 17 | bool option_anchors_zero_fee_htlc_tx) |
| 18 | { |
| 19 | /* BOLT #3: |
| 20 | * |
| 21 | * The fee for an HTLC-timeout transaction: |
| 22 | * - If `option_anchors` applies: |
| 23 | * 1. MUST be 0. |
| 24 | * - Otherwise, MUST be calculated to match: |
| 25 | * 1. Multiply `feerate_per_kw` by 663 and divide by 1000 (rounding down). |
| 26 | */ |
| 27 | u32 base; |
| 28 | |
| 29 | if (option_anchors_zero_fee_htlc_tx) |
| 30 | return AMOUNT_SAT(0); |
| 31 | |
| 32 | /* FIXME: Older bolt had "(666 if `option_anchor_outputs` applies)" */ |
| 33 | if (option_anchor_outputs) |
| 34 | base = 666; |
| 35 | else |
| 36 | base = 663; |
| 37 | return amount_tx_fee(base + elements_tx_overhead(chainparams, 1, 1), |
| 38 | feerate_per_kw); |
| 39 | } |
| 40 | |
| 41 | static inline struct amount_sat htlc_success_fee(u32 feerate_per_kw, |
| 42 | bool option_anchor_outputs, |
no test coverage detected