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

Function handle_peer_in

openingd/dualopend.c:3701–3788  ·  view source on GitHub ↗

~ Standard "peer sent a message, handle it" demuxer. Though it really only * handles a few messages, we use the standard form as principle of least * surprise. */

Source from the content-addressed store, hash-verified

3699 * handles a few messages, we use the standard form as principle of least
3700 * surprise. */
3701static u8 *handle_peer_in(struct state *state)
3702{
3703 u8 *msg = peer_read(tmpctx, state->pps);
3704 enum peer_wire t = fromwire_peektype(msg);
3705 struct channel_id channel_id;
3706
3707 switch (t) {
3708 case WIRE_OPEN_CHANNEL2:
3709 if (state->channel) {
3710 status_broken("Unexpected message %s",
3711 peer_wire_name(t));
3712 peer_failed_connection_lost();
3713 }
3714 accepter_start(state, msg);
3715 return NULL;
3716 case WIRE_TX_SIGNATURES:
3717 handle_tx_sigs(state, msg);
3718 return NULL;
3719 case WIRE_CHANNEL_READY:
3720 return handle_channel_ready(state, msg);
3721 case WIRE_SHUTDOWN:
3722 handle_peer_shutdown(state, msg);
3723 return NULL;
3724 case WIRE_INIT_RBF:
3725 rbf_remote_start(state, msg);
3726 return NULL;
3727 /* Otherwise we fall through */
3728 case WIRE_INIT:
3729 case WIRE_ERROR:
3730 case WIRE_OPEN_CHANNEL:
3731 case WIRE_ACCEPT_CHANNEL:
3732 case WIRE_FUNDING_CREATED:
3733 case WIRE_FUNDING_SIGNED:
3734 case WIRE_CLOSING_SIGNED:
3735 case WIRE_UPDATE_ADD_HTLC:
3736 case WIRE_UPDATE_FULFILL_HTLC:
3737 case WIRE_UPDATE_FAIL_HTLC:
3738 case WIRE_UPDATE_FAIL_MALFORMED_HTLC:
3739 case WIRE_COMMITMENT_SIGNED:
3740 case WIRE_REVOKE_AND_ACK:
3741 case WIRE_UPDATE_FEE:
3742 case WIRE_UPDATE_BLOCKHEIGHT:
3743 case WIRE_CHANNEL_REESTABLISH:
3744 case WIRE_ANNOUNCEMENT_SIGNATURES:
3745 case WIRE_GOSSIP_TIMESTAMP_FILTER:
3746 case WIRE_ONION_MESSAGE:
3747 case WIRE_ACCEPT_CHANNEL2:
3748 case WIRE_TX_ADD_INPUT:
3749 case WIRE_TX_REMOVE_INPUT:
3750 case WIRE_TX_ADD_OUTPUT:
3751 case WIRE_TX_REMOVE_OUTPUT:
3752 case WIRE_TX_COMPLETE:
3753 case WIRE_ACK_RBF:
3754 case WIRE_CHANNEL_ANNOUNCEMENT:
3755 case WIRE_CHANNEL_UPDATE:
3756 case WIRE_NODE_ANNOUNCEMENT:
3757 case WIRE_QUERY_CHANNEL_RANGE:
3758 case WIRE_REPLY_CHANNEL_RANGE:

Callers 1

mainFunction · 0.70

Calls 14

peer_readFunction · 0.85
accepter_startFunction · 0.85
handle_tx_sigsFunction · 0.85
handle_channel_readyFunction · 0.85
rbf_remote_startFunction · 0.85
peer_writeFunction · 0.85
extract_channel_idFunction · 0.85
tal_hexFunction · 0.85
handle_peer_shutdownFunction · 0.70
fromwire_peektypeFunction · 0.50
peer_wire_nameFunction · 0.50

Tested by

no test coverage detected