mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
gossipd: allow calling of peer_error on peers which aren't local.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
5eea772c53
commit
39c781aebb
@ -291,6 +291,22 @@ static void reached_peer(struct daemon *daemon, const struct pubkey *id,
|
||||
tal_free(r);
|
||||
}
|
||||
|
||||
static void queue_peer_msg(struct peer *peer, const u8 *msg TAKES)
|
||||
{
|
||||
const u8 *send;
|
||||
|
||||
if (peer->local) {
|
||||
msg_enqueue(&peer->local->peer_out, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Use gossip_index 0 meaning don't update index */
|
||||
send = towire_gossip_send_gossip(NULL, 0, msg);
|
||||
if (taken(msg))
|
||||
tal_free(msg);
|
||||
daemon_conn_send(peer->remote, take(send));
|
||||
}
|
||||
|
||||
static void peer_error(struct peer *peer, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -303,8 +319,7 @@ static void peer_error(struct peer *peer, const char *fmt, ...)
|
||||
|
||||
/* Send error: we'll close after writing this. */
|
||||
va_start(ap, fmt);
|
||||
msg_enqueue(&peer->local->peer_out,
|
||||
take(towire_errorfmtv(peer, NULL, fmt, ap)));
|
||||
queue_peer_msg(peer, take(towire_errorfmtv(peer, NULL, fmt, ap)));
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user