mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
lightningd: reactivate peers.
This is surprisingly simple. We set up the watches for funding tx depth and the funding output, then if it's not onchain we ask gossipd to reconnect. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
1b41335121
commit
a5c65e2c9b
@ -2718,23 +2718,23 @@ static void activate_peer(struct peer *peer)
|
||||
{
|
||||
assert(!peer->owner);
|
||||
|
||||
switch (peer->state) {
|
||||
case UNINITIALIZED:
|
||||
abort();
|
||||
|
||||
case OPENINGD:
|
||||
case CHANNELD_AWAITING_LOCKIN:
|
||||
case CHANNELD_NORMAL:
|
||||
case CHANNELD_SHUTTING_DOWN:
|
||||
case CLOSINGD_SIGEXCHANGE:
|
||||
case CLOSINGD_COMPLETE:
|
||||
case FUNDING_SPEND_SEEN:
|
||||
case ONCHAIND_CHEATED:
|
||||
case ONCHAIND_THEIR_UNILATERAL:
|
||||
case ONCHAIND_OUR_UNILATERAL:
|
||||
case ONCHAIND_MUTUAL:
|
||||
log_broken(peer->log, "FIXME: Implement activate_peer(%s)",
|
||||
/* FIXME: We should never have these in the database! */
|
||||
if (!peer->funding_txid) {
|
||||
log_broken(peer->log, "activate_peer(%s) with no funding txid?",
|
||||
peer_state_name(peer->state));
|
||||
return;
|
||||
}
|
||||
|
||||
/* This may be unnecessary, but it's harmless. */
|
||||
watch_txid(peer, peer->ld->topology, peer, peer->funding_txid,
|
||||
funding_lockin_cb, NULL);
|
||||
|
||||
watch_txo(peer, peer->ld->topology, peer, peer->funding_txid, peer->funding_outnum,
|
||||
funding_spent, NULL);
|
||||
|
||||
if (peer_wants_reconnect(peer)) {
|
||||
u8 *msg = towire_gossipctl_reach_peer(peer, &peer->id);
|
||||
subd_send_msg(peer->ld->gossip, take(msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user