openingd: use wirestring instead of u8 array for why negotiation failed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-02-08 11:55:12 +10:30 committed by Christian Decker
parent b7db06b577
commit 780b620cb1
3 changed files with 4 additions and 8 deletions

View File

@ -2412,15 +2412,14 @@ static unsigned int opening_negotiation_failed(struct subd *openingd,
struct crypto_state cs;
u64 gossip_index;
struct peer *peer = openingd->peer;
u8 *err;
const char *why;
char *why;
/* We need the peer fd and gossip fd. */
if (tal_count(fds) == 0)
return 2;
if (!fromwire_opening_negotiation_failed(msg, msg, NULL,
&cs, &gossip_index, &err)) {
&cs, &gossip_index, &why)) {
peer_internal_error(peer,
"bad OPENING_NEGOTIATION_FAILED %s",
tal_hex(msg, msg));
@ -2433,7 +2432,6 @@ static unsigned int opening_negotiation_failed(struct subd *openingd,
subd_send_fd(openingd->ld->gossip, fds[0]);
subd_send_fd(openingd->ld->gossip, fds[1]);
why = tal_strndup(peer, (const char *)err, tal_len(err));
log_unusual(peer->log, "Opening negotiation failed: %s", why);
/* This will free openingd, since that's peer->owner */

View File

@ -91,7 +91,7 @@ static void negotiation_failed(struct state *state, bool send_error,
/* Tell master we should return to gossiping. */
msg = towire_opening_negotiation_failed(state, &state->cs,
state->gossip_index,
(const u8 *)errmsg);
errmsg);
wire_sync_write(REQ_FD, msg);
fdpass_send(REQ_FD, PEER_FD);
fdpass_send(REQ_FD, GOSSIP_FD);

View File

@ -81,7 +81,5 @@ opening_fundee_reply,,funding_signed_msg,msglen*u8
opening_negotiation_failed,6010
opening_negotiation_failed,,crypto_state,struct crypto_state
opening_negotiation_failed,,gossip_index,u64
opening_negotiation_failed,,len,u16
# FIXME: string support!
opening_negotiation_failed,,msg,len*u8
opening_negotiation_failed,,msg,wirestring

1 #include <common/cryptomsg.h>
81
82
83
84
85