~ 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. */
| 4194 | * handles a few messages, we use the standard form as principle of least |
| 4195 | * surprise. */ |
| 4196 | static u8 *handle_peer_in(struct state *state) |
| 4197 | { |
| 4198 | u8 *msg = peer_read(tmpctx, state->pps); |
| 4199 | enum peer_wire t = fromwire_peektype(msg); |
| 4200 | struct channel_id channel_id; |
| 4201 | |
| 4202 | if (state->aborted_err && t != WIRE_TX_ABORT) { |
| 4203 | status_debug("Rcvd %s but already" |
| 4204 | " sent TX_ABORT," |
| 4205 | " dropping", |
| 4206 | peer_wire_name(t)); |
| 4207 | return NULL; |
| 4208 | } |
| 4209 | |
| 4210 | switch (t) { |
| 4211 | case WIRE_OPEN_CHANNEL2: |
| 4212 | if (state->channel) { |
| 4213 | status_broken("Unexpected message %s", |
| 4214 | peer_wire_name(t)); |
| 4215 | peer_failed_connection_lost(); |
| 4216 | } |
| 4217 | accepter_start(state, msg); |
| 4218 | return NULL; |
| 4219 | case WIRE_START_BATCH: |
| 4220 | /* We ignore batch messages as we dont need them */ |
| 4221 | return NULL; |
| 4222 | case WIRE_COMMITMENT_SIGNED: |
| 4223 | handle_commit_signed(state, msg); |
| 4224 | return NULL; |
| 4225 | case WIRE_TX_SIGNATURES: |
| 4226 | handle_tx_sigs(state, msg); |
| 4227 | return NULL; |
| 4228 | case WIRE_CHANNEL_READY: |
| 4229 | return handle_channel_ready(state, msg); |
| 4230 | case WIRE_SHUTDOWN: |
| 4231 | handle_peer_shutdown(state, msg); |
| 4232 | return NULL; |
| 4233 | case WIRE_TX_INIT_RBF: |
| 4234 | rbf_remote_start(state, msg); |
| 4235 | return NULL; |
| 4236 | case WIRE_TX_ABORT: |
| 4237 | handle_tx_abort(state, msg); |
| 4238 | return NULL; |
| 4239 | case WIRE_ANNOUNCEMENT_SIGNATURES: |
| 4240 | handle_announcement_signatures(state, msg); |
| 4241 | return NULL; |
| 4242 | /* Otherwise we fall through */ |
| 4243 | case WIRE_INIT: |
| 4244 | case WIRE_ERROR: |
| 4245 | case WIRE_OPEN_CHANNEL: |
| 4246 | case WIRE_ACCEPT_CHANNEL: |
| 4247 | case WIRE_FUNDING_CREATED: |
| 4248 | case WIRE_FUNDING_SIGNED: |
| 4249 | case WIRE_CLOSING_SIGNED: |
| 4250 | case WIRE_CLOSING_COMPLETE: |
| 4251 | case WIRE_CLOSING_SIG: |
| 4252 | case WIRE_UPDATE_ADD_HTLC: |
| 4253 | case WIRE_UPDATE_FULFILL_HTLC: |
no test coverage detected