mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
master: Don't crash if peer reconnects before we activate it
`activate_peer` does little more than wiring up some txwatches and asking `gossipd` to reconnect to the peer. If the peer manages to reconnect before we activate then we would crash. This just changes the `assert` causing the crash into a conditional whether we need to reconnect or not. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
7da942dec8
commit
e04619457b
@@ -2789,8 +2789,6 @@ static void activate_peer(struct peer *peer)
|
||||
{
|
||||
u8 *msg;
|
||||
|
||||
assert(!peer->owner);
|
||||
|
||||
/* Pass gossipd any addrhints we currently have */
|
||||
msg = towire_gossipctl_peer_addrhint(peer, &peer->id, &peer->addr);
|
||||
subd_send_msg(peer->ld->gossip, take(msg));
|
||||
@@ -2809,7 +2807,10 @@ static void activate_peer(struct peer *peer)
|
||||
watch_txo(peer, peer->ld->topology, peer, peer->funding_txid, peer->funding_outnum,
|
||||
funding_spent, NULL);
|
||||
|
||||
if (peer_wants_reconnect(peer)) {
|
||||
/* If peer->owner then we had a reconnect while loading and
|
||||
* activating the peers, don't ask gossipd to connect in that
|
||||
* case */
|
||||
if (!peer->owner && peer_wants_reconnect(peer)) {
|
||||
msg = towire_gossipctl_reach_peer(peer, &peer->id);
|
||||
subd_send_msg(peer->ld->gossip, take(msg));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user