mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
lightningd: don't try to delete peer from db on shutdown if it's opening.
Fortunately, we hit the assert in wallet_peer_delete() if this happens, since there are still active channels. This latent bug becomes far more likely in followup patches, where openingd is used for idle peers. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -224,11 +224,16 @@ static void shutdown_subdaemons(struct lightningd *ld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Freeing uncommitted channel will free peer. */
|
/* Freeing uncommitted channel will free peer. */
|
||||||
if (p->uncommitted_channel)
|
if (p->uncommitted_channel) {
|
||||||
tal_free(p->uncommitted_channel);
|
struct uncommitted_channel *uc = p->uncommitted_channel;
|
||||||
else
|
|
||||||
/* Removes itself from list as we free it */
|
/* Setting to NULL stops destroy_uncommitted_channel
|
||||||
tal_free(p);
|
* from trying to remove peer from db! */
|
||||||
|
p->uncommitted_channel = NULL;
|
||||||
|
tal_free(uc);
|
||||||
|
}
|
||||||
|
/* Removes itself from list as we free it */
|
||||||
|
tal_free(p);
|
||||||
}
|
}
|
||||||
db_commit_transaction(ld->wallet->db);
|
db_commit_transaction(ld->wallet->db);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -584,6 +584,10 @@ static void destroy_uncommitted_channel(struct uncommitted_channel *uc)
|
|||||||
subd_release_channel(openingd, uc);
|
subd_release_channel(openingd, uc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is how shutdown_subdaemons tells us not to delete from db! */
|
||||||
|
if (!uc->peer->uncommitted_channel)
|
||||||
|
return;
|
||||||
|
|
||||||
uc->peer->uncommitted_channel = NULL;
|
uc->peer->uncommitted_channel = NULL;
|
||||||
|
|
||||||
maybe_delete_peer(uc->peer);
|
maybe_delete_peer(uc->peer);
|
||||||
|
|||||||
Reference in New Issue
Block a user