MCPcopy Create free account
hub / github.com/ElementsProject/lightning / peer_sending_revocation

Function peer_sending_revocation

lightningd/peer_htlcs.c:2423–2458  ·  view source on GitHub ↗

The peer doesn't tell us this separately, but logically it's a separate * step to receiving commitsig */

Source from the content-addressed store, hash-verified

2421/* The peer doesn't tell us this separately, but logically it's a separate
2422 * step to receiving commitsig */
2423static 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
2460struct deferred_commitsig {
2461 struct channel *channel;

Callers 1

peer_got_commitsigFunction · 0.85

Calls 2

update_in_htlcFunction · 0.85
update_out_htlcFunction · 0.85

Tested by

no test coverage detected