mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
lightningd: handle channel cleanups more explicitly.
1. Freeing an unconfirmed channel already releases the subd, so don't do that explicitly. 2. Use channel->owner to transfer ownership where possible, using channel_set_owner() which handles all the cases. This simplifies the code and makes it more readable, IMHO. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -17,8 +17,9 @@
|
||||
|
||||
static void destroy_uncommitted_channel(struct uncommitted_channel *uc)
|
||||
{
|
||||
if (uc->open_daemon) {
|
||||
struct subd *open_daemon= uc->open_daemon;
|
||||
struct subd *open_daemon = uc->open_daemon;
|
||||
|
||||
if (open_daemon) {
|
||||
uc->open_daemon = NULL;
|
||||
subd_release_channel(open_daemon, uc);
|
||||
}
|
||||
@@ -115,10 +116,6 @@ void kill_uncommitted_channel(struct uncommitted_channel *uc,
|
||||
{
|
||||
log_info(uc->log, "Killing opening daemon: %s", why);
|
||||
|
||||
/* Close opend daemon. */
|
||||
subd_release_channel(uc->open_daemon, uc);
|
||||
uc->open_daemon = NULL;
|
||||
|
||||
uncommitted_channel_disconnect(uc, LOG_INFORM, why);
|
||||
tal_free(uc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user