mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
lightningd/peer_control.c: remove unnecessary reconnected field.
It can be on the stack. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a827d2b2bb
commit
0c07856ae4
@ -177,7 +177,8 @@ void peer_set_condition(struct peer *peer, enum peer_state old_state,
|
|||||||
static bool peer_start_channeld(struct peer *peer,
|
static bool peer_start_channeld(struct peer *peer,
|
||||||
const struct crypto_state *cs,
|
const struct crypto_state *cs,
|
||||||
int peer_fd, int gossip_fd,
|
int peer_fd, int gossip_fd,
|
||||||
const u8 *funding_signed);
|
const u8 *funding_signed,
|
||||||
|
bool reconnected);
|
||||||
|
|
||||||
/* Send (encrypted) error message, then close. */
|
/* Send (encrypted) error message, then close. */
|
||||||
static struct io_plan *send_error(struct io_conn *conn,
|
static struct io_plan *send_error(struct io_conn *conn,
|
||||||
@ -234,7 +235,7 @@ static bool get_peer_gossipfd_reply(struct subd *subd, const u8 *msg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We never re-transmit funding_signed. */
|
/* We never re-transmit funding_signed. */
|
||||||
peer_start_channeld(peer, &ggf->cs, ggf->peer_fd, fds[0], NULL);
|
peer_start_channeld(peer, &ggf->cs, ggf->peer_fd, fds[0], NULL, true);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
close_gossipfd:
|
close_gossipfd:
|
||||||
@ -292,9 +293,6 @@ static bool peer_reconnected(struct lightningd *ld,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need this for init */
|
|
||||||
peer->reconnected = true;
|
|
||||||
|
|
||||||
switch (peer->state) {
|
switch (peer->state) {
|
||||||
/* This can't happen. */
|
/* This can't happen. */
|
||||||
case UNINITIALIZED:
|
case UNINITIALIZED:
|
||||||
@ -368,7 +366,6 @@ void add_peer(struct lightningd *ld, u64 unique_id,
|
|||||||
peer->error = NULL;
|
peer->error = NULL;
|
||||||
peer->unique_id = unique_id;
|
peer->unique_id = unique_id;
|
||||||
peer->id = *id;
|
peer->id = *id;
|
||||||
peer->reconnected = false;
|
|
||||||
peer->funding_txid = NULL;
|
peer->funding_txid = NULL;
|
||||||
peer->remote_funding_locked = false;
|
peer->remote_funding_locked = false;
|
||||||
peer->scid = NULL;
|
peer->scid = NULL;
|
||||||
@ -865,7 +862,7 @@ static void opening_got_hsm_funding_sig(struct funding_channel *fc,
|
|||||||
command_success(fc->cmd, null_response(fc->cmd));
|
command_success(fc->cmd, null_response(fc->cmd));
|
||||||
|
|
||||||
/* Start normal channel daemon. */
|
/* Start normal channel daemon. */
|
||||||
peer_start_channeld(fc->peer, cs, peer_fd, gossip_fd, NULL);
|
peer_start_channeld(fc->peer, cs, peer_fd, gossip_fd, NULL, false);
|
||||||
peer_set_condition(fc->peer, OPENINGD, CHANNELD_AWAITING_LOCKIN);
|
peer_set_condition(fc->peer, OPENINGD, CHANNELD_AWAITING_LOCKIN);
|
||||||
|
|
||||||
wallet_confirm_utxos(fc->peer->ld->wallet, fc->utxomap);
|
wallet_confirm_utxos(fc->peer->ld->wallet, fc->utxomap);
|
||||||
@ -1397,7 +1394,8 @@ static int channel_msg(struct subd *sd, const u8 *msg, const int *fds)
|
|||||||
static bool peer_start_channeld(struct peer *peer,
|
static bool peer_start_channeld(struct peer *peer,
|
||||||
const struct crypto_state *cs,
|
const struct crypto_state *cs,
|
||||||
int peer_fd, int gossip_fd,
|
int peer_fd, int gossip_fd,
|
||||||
const u8 *funding_signed)
|
const u8 *funding_signed,
|
||||||
|
bool reconnected)
|
||||||
{
|
{
|
||||||
const tal_t *tmpctx = tal_tmpctx(peer);
|
const tal_t *tmpctx = tal_tmpctx(peer);
|
||||||
u8 *msg, *initmsg;
|
u8 *msg, *initmsg;
|
||||||
@ -1501,7 +1499,7 @@ static bool peer_start_channeld(struct peer *peer,
|
|||||||
peer->scid != NULL,
|
peer->scid != NULL,
|
||||||
peer->remote_funding_locked,
|
peer->remote_funding_locked,
|
||||||
&funding_channel_id,
|
&funding_channel_id,
|
||||||
peer->reconnected,
|
reconnected,
|
||||||
shutdown_scriptpubkey,
|
shutdown_scriptpubkey,
|
||||||
peer->remote_shutdown_scriptpubkey != NULL,
|
peer->remote_shutdown_scriptpubkey != NULL,
|
||||||
peer->channel_flags,
|
peer->channel_flags,
|
||||||
@ -1672,7 +1670,7 @@ static bool opening_fundee_finished(struct subd *opening,
|
|||||||
peer->owner = NULL;
|
peer->owner = NULL;
|
||||||
|
|
||||||
/* On to normal operation! */
|
/* On to normal operation! */
|
||||||
peer_start_channeld(peer, &cs, fds[0], fds[1], funding_signed);
|
peer_start_channeld(peer, &cs, fds[0], fds[1], funding_signed, false);
|
||||||
peer_set_condition(peer, OPENINGD, CHANNELD_AWAITING_LOCKIN);
|
peer_set_condition(peer, OPENINGD, CHANNELD_AWAITING_LOCKIN);
|
||||||
|
|
||||||
/* Tell opening daemon to exit. */
|
/* Tell opening daemon to exit. */
|
||||||
|
@ -50,9 +50,6 @@ struct peer {
|
|||||||
/* Channel flags from opening message. */
|
/* Channel flags from opening message. */
|
||||||
u8 channel_flags;
|
u8 channel_flags;
|
||||||
|
|
||||||
/* If we've disconnected, this is set. */
|
|
||||||
bool reconnected;
|
|
||||||
|
|
||||||
/* Where we connected to, or it connected from. */
|
/* Where we connected to, or it connected from. */
|
||||||
struct netaddr netaddr;
|
struct netaddr netaddr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user