Browse Source

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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
780b620cb1
  1. 6
      lightningd/peer_control.c
  2. 2
      openingd/opening.c
  3. 4
      openingd/opening_wire.csv

6
lightningd/peer_control.c

@ -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 */

2
openingd/opening.c

@ -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);

4
openingd/opening_wire.csv

@ -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

Can't render this file because it has a wrong number of fields in line 3.
Loading…
Cancel
Save