Fix: fundee can forget channel if it receives error during CHANNELD_AWAITING_LOCKIN

This commit is contained in:
trueptolemy
2019-08-27 02:31:25 +08:00
committed by neil saitug
parent a3b43fa196
commit db145f575b
3 changed files with 43 additions and 4 deletions

View File

@@ -441,9 +441,18 @@ void channel_errmsg(struct channel *channel,
* - MUST fail the channel referred to by the error message,
* if that channel is with the sending node.
*/
channel_fail_permanent(channel, "%s: %s ERROR %s",
channel->owner->name,
err_for_them ? "sent" : "received", desc);
/* We should immediately forget the channel if we receive error during
* CHANNELD_AWAITING_LOCKIN if we are fundee. */
if (!err_for_them && channel->funder == REMOTE
&& channel->state == CHANNELD_AWAITING_LOCKIN)
channel_fail_forget(channel, "%s: %s ERROR %s",
channel->owner->name,
err_for_them ? "sent" : "received", desc);
else
channel_fail_permanent(channel, "%s: %s ERROR %s",
channel->owner->name,
err_for_them ? "sent" : "received", desc);
}
struct peer_connected_hook_payload {