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

Function peer_sending_revocation

lightningd/peer_htlcs.c:2102–2137  ·  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

2100/* The peer doesn't tell us this separately, but logically it's a separate
2101 * step to receiving commitsig */
2102static bool peer_sending_revocation(struct channel *channel,
2103 struct added_htlc *added,
2104 struct fulfilled_htlc *fulfilled,
2105 struct failed_htlc **failed,
2106 struct changed_htlc *changed)
2107{
2108 size_t i;
2109
2110 for (i = 0; i < tal_count(added); i++) {
2111 if (!update_in_htlc(channel, added[i].id, SENT_ADD_REVOCATION))
2112 return false;
2113 }
2114 for (i = 0; i < tal_count(fulfilled); i++) {
2115 if (!update_out_htlc(channel, fulfilled[i].id,
2116 SENT_REMOVE_REVOCATION))
2117 return false;
2118 }
2119 for (i = 0; i < tal_count(failed); i++) {
2120 if (!update_out_htlc(channel, failed[i]->id, SENT_REMOVE_REVOCATION))
2121 return false;
2122 }
2123 for (i = 0; i < tal_count(changed); i++) {
2124 if (changed[i].newstate == RCVD_ADD_ACK_COMMIT) {
2125 if (!update_out_htlc(channel, changed[i].id,
2126 SENT_ADD_ACK_REVOCATION))
2127 return false;
2128 } else {
2129 if (!update_in_htlc(channel, changed[i].id,
2130 SENT_REMOVE_ACK_REVOCATION))
2131 return false;
2132 }
2133 }
2134
2135 channel->last_was_revoke = true;
2136 return true;
2137}
2138
2139struct deferred_commitsig {
2140 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