| 419 | |
| 420 | #ifdef DEBUG |
| 421 | static struct amount_sat calc_fee(const struct bitcoin_tx *tx, struct amount_sat input) |
| 422 | { |
| 423 | size_t i; |
| 424 | struct amount_sat output = AMOUNT_SAT(0), fee; |
| 425 | |
| 426 | for (i = 0; i < tal_count(tx->output); i++) |
| 427 | output.satoshis += tx->output[i].amount; |
| 428 | |
| 429 | if (!amount_sub_sat(&fee, input, output)) |
| 430 | abort(); |
| 431 | return fee; |
| 432 | } |
| 433 | |
| 434 | /* For debugging, we do brute-force increase to find thresholds */ |
| 435 | static u32 increase(u32 feerate_per_kw) |