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

Function peer_expect_msg_four

channeld/channeld.c:3048–3075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3046}
3047
3048static const u8 *peer_expect_msg_four(const tal_t *ctx,
3049 struct peer *peer,
3050 enum peer_wire expect_type,
3051 enum peer_wire second_allowed_type,
3052 enum peer_wire third_allowed_type,
3053 enum peer_wire fourth_allowed_type)
3054{
3055 u8 *msg;
3056 enum peer_wire type;
3057
3058 msg = peer_read(ctx, peer->pps);
3059 type = fromwire_peektype(msg);
3060 if (type != expect_type
3061 && type != second_allowed_type
3062 && type != third_allowed_type
3063 && type != fourth_allowed_type)
3064 peer_failed_warn(peer->pps, &peer->channel_id,
3065 "Got incorrect message from peer: %s"
3066 " (should be %s or %s or %s of %s) [%s]",
3067 peer_wire_name(type),
3068 peer_wire_name(expect_type),
3069 peer_wire_name(second_allowed_type),
3070 peer_wire_name(third_allowed_type),
3071 peer_wire_name(fourth_allowed_type),
3072 sanitize_error(tmpctx, msg, &peer->channel_id));
3073
3074 return msg;
3075}
3076
3077/* In some circumstances Eclair send CHANNEL_READY after CHANNEL_REESTABLISH but
3078 * before resuming splice negotiation, so we need a way to process it in this

Callers 1

Calls 4

peer_readFunction · 0.85
fromwire_peektypeFunction · 0.85
peer_failed_warnFunction · 0.85
sanitize_errorFunction · 0.85

Tested by

no test coverage detected