| 425 | } |
| 426 | |
| 427 | static bool htlc_dust(const struct channel *channel, |
| 428 | const struct htlc **committed, |
| 429 | const struct htlc **adding, |
| 430 | const struct htlc **removing, |
| 431 | enum side side, |
| 432 | u32 feerate, |
| 433 | struct amount_msat *trim_total) |
| 434 | { |
| 435 | struct amount_sat dust_limit = channel->config[side].dust_limit; |
| 436 | bool option_anchor_outputs = channel_has(channel, OPT_ANCHOR_OUTPUTS); |
| 437 | struct amount_msat trim_rmvd = AMOUNT_MSAT(0); |
| 438 | |
| 439 | if (!commit_tx_amount_trimmed(committed, feerate, |
| 440 | dust_limit, |
| 441 | option_anchor_outputs, |
| 442 | side, trim_total)) |
| 443 | return false; |
| 444 | if (!commit_tx_amount_trimmed(adding, feerate, |
| 445 | dust_limit, |
| 446 | option_anchor_outputs, |
| 447 | side, trim_total)) |
| 448 | return false; |
| 449 | if (!commit_tx_amount_trimmed(removing, feerate, |
| 450 | dust_limit, |
| 451 | option_anchor_outputs, |
| 452 | side, &trim_rmvd)) |
| 453 | return false; |
| 454 | |
| 455 | return amount_msat_sub(trim_total, *trim_total, trim_rmvd); |
| 456 | } |
| 457 | |
| 458 | /* |
| 459 | * There is a corner case where the opener can spend so much that the |
no test coverage detected