The peer doesn't tell us this separately, but logically it's a separate * step to receiving commitsig */
| 2341 | /* The peer doesn't tell us this separately, but logically it's a separate |
| 2342 | * step to receiving commitsig */ |
| 2343 | static bool peer_sending_revocation(struct channel *channel, |
| 2344 | struct added_htlc **added, |
| 2345 | struct fulfilled_htlc *fulfilled, |
| 2346 | struct failed_htlc **failed, |
| 2347 | struct changed_htlc *changed) |
| 2348 | { |
| 2349 | size_t i; |
| 2350 | |
| 2351 | for (i = 0; i < tal_count(added); i++) { |
| 2352 | if (!update_in_htlc(channel, added[i]->id, SENT_ADD_REVOCATION)) |
| 2353 | return false; |
| 2354 | } |
| 2355 | for (i = 0; i < tal_count(fulfilled); i++) { |
| 2356 | if (!update_out_htlc(channel, fulfilled[i].id, |
| 2357 | SENT_REMOVE_REVOCATION)) |
| 2358 | return false; |
| 2359 | } |
| 2360 | for (i = 0; i < tal_count(failed); i++) { |
| 2361 | if (!update_out_htlc(channel, failed[i]->id, SENT_REMOVE_REVOCATION)) |
| 2362 | return false; |
| 2363 | } |
| 2364 | for (i = 0; i < tal_count(changed); i++) { |
| 2365 | if (changed[i].newstate == RCVD_ADD_ACK_COMMIT) { |
| 2366 | if (!update_out_htlc(channel, changed[i].id, |
| 2367 | SENT_ADD_ACK_REVOCATION)) |
| 2368 | return false; |
| 2369 | } else { |
| 2370 | if (!update_in_htlc(channel, changed[i].id, |
| 2371 | SENT_REMOVE_ACK_REVOCATION)) |
| 2372 | return false; |
| 2373 | } |
| 2374 | } |
| 2375 | |
| 2376 | channel->last_was_revoke = true; |
| 2377 | return true; |
| 2378 | } |
| 2379 | |
| 2380 | struct deferred_commitsig { |
| 2381 | struct channel *channel; |
no test coverage detected