The peer doesn't tell us this separately, but logically it's a separate * step to receiving commitsig */
| 2421 | /* The peer doesn't tell us this separately, but logically it's a separate |
| 2422 | * step to receiving commitsig */ |
| 2423 | static bool peer_sending_revocation(struct channel *channel, |
| 2424 | struct added_htlc **added, |
| 2425 | struct fulfilled_htlc *fulfilled, |
| 2426 | struct failed_htlc **failed, |
| 2427 | struct changed_htlc *changed) |
| 2428 | { |
| 2429 | size_t i; |
| 2430 | |
| 2431 | for (i = 0; i < tal_count(added); i++) { |
| 2432 | if (!update_in_htlc(channel, added[i]->id, SENT_ADD_REVOCATION)) |
| 2433 | return false; |
| 2434 | } |
| 2435 | for (i = 0; i < tal_count(fulfilled); i++) { |
| 2436 | if (!update_out_htlc(channel, fulfilled[i].id, |
| 2437 | SENT_REMOVE_REVOCATION)) |
| 2438 | return false; |
| 2439 | } |
| 2440 | for (i = 0; i < tal_count(failed); i++) { |
| 2441 | if (!update_out_htlc(channel, failed[i]->id, SENT_REMOVE_REVOCATION)) |
| 2442 | return false; |
| 2443 | } |
| 2444 | for (i = 0; i < tal_count(changed); i++) { |
| 2445 | if (changed[i].newstate == RCVD_ADD_ACK_COMMIT) { |
| 2446 | if (!update_out_htlc(channel, changed[i].id, |
| 2447 | SENT_ADD_ACK_REVOCATION)) |
| 2448 | return false; |
| 2449 | } else { |
| 2450 | if (!update_in_htlc(channel, changed[i].id, |
| 2451 | SENT_REMOVE_ACK_REVOCATION)) |
| 2452 | return false; |
| 2453 | } |
| 2454 | } |
| 2455 | |
| 2456 | channel->last_was_revoke = true; |
| 2457 | return true; |
| 2458 | } |
| 2459 | |
| 2460 | struct deferred_commitsig { |
| 2461 | struct channel *channel; |
no test coverage detected