| 1443 | } |
| 1444 | |
| 1445 | bool pending_updates(const struct channel *channel, |
| 1446 | enum side side, |
| 1447 | bool uncommitted_ok) |
| 1448 | { |
| 1449 | struct htlc_map_iter it; |
| 1450 | const struct htlc *htlc; |
| 1451 | |
| 1452 | /* Initiator might have fee changes or blockheight updates in play. */ |
| 1453 | if (side == channel->opener) { |
| 1454 | if (!feerate_changes_done(channel->fee_states, uncommitted_ok)) |
| 1455 | return true; |
| 1456 | |
| 1457 | if (!blockheight_changes_done(channel->blockheight_states, |
| 1458 | uncommitted_ok)) |
| 1459 | return true; |
| 1460 | } |
| 1461 | |
| 1462 | for (htlc = htlc_map_first(channel->htlcs, &it); |
| 1463 | htlc; |
| 1464 | htlc = htlc_map_next(channel->htlcs, &it)) { |
| 1465 | int flags = htlc_state_flags(htlc->state); |
| 1466 | |
| 1467 | /* If it's still being added, its owner added it. */ |
| 1468 | if (flags & HTLC_ADDING) { |
| 1469 | /* It might be OK if it's added, but not committed */ |
| 1470 | if (uncommitted_ok |
| 1471 | && (flags & HTLC_FLAG(!side, HTLC_F_PENDING))) |
| 1472 | continue; |
| 1473 | if (htlc_owner(htlc) == side) |
| 1474 | return true; |
| 1475 | /* If it's being removed, non-owner removed it */ |
| 1476 | } else if (htlc_state_flags(htlc->state) & HTLC_REMOVING) { |
| 1477 | /* It might be OK if it's removed, but not committed */ |
| 1478 | if (uncommitted_ok |
| 1479 | && (flags & HTLC_FLAG(!side, HTLC_F_PENDING))) |
| 1480 | continue; |
| 1481 | if (htlc_owner(htlc) != side) |
| 1482 | return true; |
| 1483 | } |
| 1484 | } |
| 1485 | |
| 1486 | return false; |
| 1487 | } |
| 1488 | |
| 1489 | bool channel_force_htlcs(struct channel *channel, |
| 1490 | const struct existing_htlc **htlcs) |
no test coverage detected