The peer doesn't tell us this separately, but logically it's a separate * step to receiving commitsig */
| 2377 | /* The peer doesn't tell us this separately, but logically it's a separate |
| 2378 | * step to receiving commitsig */ |
| 2379 | static bool peer_sending_revocation(struct channel *channel, |
| 2380 | struct added_htlc **added, |
| 2381 | struct fulfilled_htlc *fulfilled, |
| 2382 | struct failed_htlc **failed, |
| 2383 | struct changed_htlc *changed) |
| 2384 | { |
| 2385 | size_t i; |
| 2386 | |
| 2387 | for (i = 0; i < tal_count(added); i++) { |
| 2388 | if (!update_in_htlc(channel, added[i]->id, SENT_ADD_REVOCATION)) |
| 2389 | return false; |
| 2390 | } |
| 2391 | for (i = 0; i < tal_count(fulfilled); i++) { |
| 2392 | if (!update_out_htlc(channel, fulfilled[i].id, |
| 2393 | SENT_REMOVE_REVOCATION)) |
| 2394 | return false; |
| 2395 | } |
| 2396 | for (i = 0; i < tal_count(failed); i++) { |
| 2397 | if (!update_out_htlc(channel, failed[i]->id, SENT_REMOVE_REVOCATION)) |
| 2398 | return false; |
| 2399 | } |
| 2400 | for (i = 0; i < tal_count(changed); i++) { |
| 2401 | if (changed[i].newstate == RCVD_ADD_ACK_COMMIT) { |
| 2402 | if (!update_out_htlc(channel, changed[i].id, |
| 2403 | SENT_ADD_ACK_REVOCATION)) |
| 2404 | return false; |
| 2405 | } else { |
| 2406 | if (!update_in_htlc(channel, changed[i].id, |
| 2407 | SENT_REMOVE_ACK_REVOCATION)) |
| 2408 | return false; |
| 2409 | } |
| 2410 | } |
| 2411 | |
| 2412 | channel->last_was_revoke = true; |
| 2413 | return true; |
| 2414 | } |
| 2415 | |
| 2416 | struct deferred_commitsig { |
| 2417 | struct channel *channel; |
no test coverage detected