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

Function peer_in

channeld/channeld.c:2215–2321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2213}
2214
2215static void peer_in(struct peer *peer, const u8 *msg)
2216{
2217 enum peer_wire type = fromwire_peektype(msg);
2218
2219 if (handle_peer_error(peer->pps, &peer->channel_id, msg))
2220 return;
2221
2222 /* Must get channel_ready before almost anything. */
2223 if (!peer->channel_ready[REMOTE]) {
2224 if (type != WIRE_CHANNEL_READY
2225 && type != WIRE_SHUTDOWN
2226 /* We expect these for v2 !! */
2227 && type != WIRE_TX_SIGNATURES
2228 /* lnd sends these early; it's harmless. */
2229 && type != WIRE_UPDATE_FEE
2230 && type != WIRE_ANNOUNCEMENT_SIGNATURES) {
2231 peer_failed_warn(peer->pps, &peer->channel_id,
2232 "%s (%u) before funding locked",
2233 peer_wire_name(type), type);
2234 }
2235 }
2236
2237 switch (type) {
2238 case WIRE_CHANNEL_READY:
2239 handle_peer_channel_ready(peer, msg);
2240 return;
2241 case WIRE_ANNOUNCEMENT_SIGNATURES:
2242 handle_peer_announcement_signatures(peer, msg);
2243 return;
2244 case WIRE_UPDATE_ADD_HTLC:
2245 handle_peer_add_htlc(peer, msg);
2246 return;
2247 case WIRE_COMMITMENT_SIGNED:
2248 handle_peer_commit_sig(peer, msg);
2249 return;
2250 case WIRE_UPDATE_FEE:
2251 handle_peer_feechange(peer, msg);
2252 return;
2253 case WIRE_UPDATE_BLOCKHEIGHT:
2254 handle_peer_blockheight_change(peer, msg);
2255 return;
2256 case WIRE_REVOKE_AND_ACK:
2257 handle_peer_revoke_and_ack(peer, msg);
2258 return;
2259 case WIRE_UPDATE_FULFILL_HTLC:
2260 handle_peer_fulfill_htlc(peer, msg);
2261 return;
2262 case WIRE_UPDATE_FAIL_HTLC:
2263 handle_peer_fail_htlc(peer, msg);
2264 return;
2265 case WIRE_UPDATE_FAIL_MALFORMED_HTLC:
2266 handle_peer_fail_malformed_htlc(peer, msg);
2267 return;
2268 case WIRE_SHUTDOWN:
2269 handle_peer_shutdown(peer, msg);
2270 return;
2271
2272#if EXPERIMENTAL_FEATURES

Callers 2

peer_reconnectFunction · 0.85
mainFunction · 0.85

Calls 15

peer_failed_warnFunction · 0.85
handle_peer_add_htlcFunction · 0.85
handle_peer_commit_sigFunction · 0.85
handle_peer_feechangeFunction · 0.85
handle_peer_fulfill_htlcFunction · 0.85
handle_peer_fail_htlcFunction · 0.85
handle_stfuFunction · 0.85

Tested by

no test coverage detected