Skip to content

Commit

Permalink
lightningd: use return value of peer_start_channeld()
Browse files Browse the repository at this point in the history
It tells us if it's failed, so we should use that rather than
reporting failure twice.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Apr 20, 2024
1 parent 86c29b6 commit cd7175b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lightningd/opening_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,11 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
if (pbase)
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);

/* If this fails, it cleans up */
if (!peer_start_channeld(channel, peer_fd, NULL, false, NULL))
return;

funding_success(channel);
peer_start_channeld(channel, peer_fd, NULL, false, NULL);

cleanup:
/* Frees fc too */
Expand Down Expand Up @@ -557,10 +560,9 @@ static void opening_fundee_finished(struct subd *openingd,
if (pbase)
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);

/* On to normal operation! */
peer_start_channeld(channel, peer_fd, fwd_msg, false, NULL);

tal_free(uc);
/* On to normal operation (frees if it fails!) */
if (peer_start_channeld(channel, peer_fd, fwd_msg, false, NULL))
tal_free(uc);
return;

failed:
Expand Down

0 comments on commit cd7175b

Please sign in to comment.