lightningd/handshake: rename WIRE_BAD_COMMAND to WIRE_HANDSHAKE_BAD_COMMAND

So it doesn't clash with opening daemon, for example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-02-24 16:22:56 +10:30
parent b1403a764f
commit be7c7b9732
4 changed files with 16 additions and 13 deletions

View File

@ -988,9 +988,9 @@ int main(int argc, char *argv[])
msg = wire_sync_read(NULL, REQ_FD);
if (!msg)
status_failed(WIRE_BAD_COMMAND, "%s", strerror(errno));
status_failed(WIRE_HANDSHAKE_BAD_COMMAND, "%s", strerror(errno));
if (clientfd < 0)
status_failed(WIRE_BAD_FDPASS, "%s", strerror(errno));
status_failed(WIRE_HANDSHAKE_BAD_FDPASS, "%s", strerror(errno));
if (fromwire_handshake_responder_req(msg, NULL, &my_id)) {
responder(clientfd, &my_id, &their_id, &ck, &sk, &rk);
@ -1006,7 +1006,7 @@ int main(int argc, char *argv[])
wire_sync_write(REQ_FD,
towire_handshake_initiator_resp(msg, cs));
} else
status_failed(WIRE_BAD_COMMAND, "%i", fromwire_peektype(msg));
status_failed(WIRE_HANDSHAKE_BAD_COMMAND, "%i", fromwire_peektype(msg));
/* Hand back the fd. */
fdpass_send(REQ_FD, clientfd);
@ -1014,9 +1014,9 @@ int main(int argc, char *argv[])
/* Wait for exit command (avoid status close being read before reqfd) */
msg = wire_sync_read(msg, REQ_FD);
if (!msg)
status_failed(WIRE_BAD_COMMAND, "%s", strerror(errno));
status_failed(WIRE_HANDSHAKE_BAD_COMMAND, "%s", strerror(errno));
if (!fromwire_handshake_exit_req(msg, NULL))
status_failed(WIRE_BAD_COMMAND, "Expected exit req not %i",
status_failed(WIRE_HANDSHAKE_BAD_COMMAND, "Expected exit req not %i",
fromwire_peektype(msg));
tal_free(msg);
return 0;

View File

@ -1,5 +1,5 @@
bad_command,0x8000
bad_fdpass,0x8001
handshake_bad_command,0x8000
handshake_bad_fdpass,0x8001
initr_act1_bad_ecdh_for_ss,0x8011
initr_act1_write_failed,0x8012
initr_act2_read_failed,0x8013

View File

@ -314,7 +314,10 @@ static void open_channel(struct state *state, const struct points *ours)
if (!fromwire_opening_open_funding(msg, NULL,
&state->funding_txid,
&state->funding_txout))
peer_failed(PEER_FD, &state->cs, NULL, WIRE_BAD_COMMAND, "reading opening_open_funding");
peer_failed(PEER_FD, &state->cs, NULL,
WIRE_OPENING_PEER_READ_FAILED,
"Expected valid opening_open_funding: %s",
tal_hex(trc, msg));
state->channel = new_channel(state,
&state->funding_txid,
@ -608,7 +611,7 @@ int main(int argc, char *argv[])
msg = wire_sync_read(state, REQ_FD);
if (!msg)
status_failed(WIRE_BAD_COMMAND, "%s", strerror(errno));
status_failed(WIRE_OPENING_BAD_COMMAND, "%s", strerror(errno));
if (!fromwire_opening_init(msg, NULL,
&state->localconf,
@ -616,7 +619,7 @@ int main(int argc, char *argv[])
&state->maxconf,
&state->cs,
&seed))
status_failed(WIRE_BAD_COMMAND, "%s", strerror(errno));
status_failed(WIRE_OPENING_BAD_COMMAND, "%s", strerror(errno));
tal_free(msg);
/* We derive everything from the one secret seed. */
@ -638,9 +641,9 @@ int main(int argc, char *argv[])
/* Wait for exit command (avoid state close being read before reqfd) */
msg = wire_sync_read(state, REQ_FD);
if (!msg)
status_failed(WIRE_BAD_COMMAND, "%s", strerror(errno));
status_failed(WIRE_OPENING_BAD_COMMAND, "%s", strerror(errno));
if (!fromwire_opening_exit_req(msg, NULL))
status_failed(WIRE_BAD_COMMAND, "Expected exit req not %i",
status_failed(WIRE_OPENING_BAD_COMMAND, "Expected exit req not %i",
fromwire_peektype(msg));
tal_free(state);
return 0;

View File

@ -1,5 +1,5 @@
# Shouldn't happen
bad_command,0x8000
opening_bad_command,0x8000
# Also shouldn't happen
opening_key_derivation_failed,0x8001
# Also shouldn't happen

1 # Shouldn't happen
2 bad_command,0x8000 opening_bad_command,0x8000
3 # Also shouldn't happen
4 opening_key_derivation_failed,0x8001
5 # Also shouldn't happen